akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int mod=1000000007;
const double PI = 3.14159265359;
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define INF 1000000000000
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define FOR(i,n) for(int i=0;i<(n);i++)
#define FORA(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define count_1(n)  __builtin_popcountll(n)
#define parity(n)   __builtin_parityll(n)   //Even parity 0 as output
void show    (int a[], int arraysize) { for (int i = 0; i < arraysize; ++i)  {cout << a[i] << " ";}	cout<<endl;}
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b);}
void sieve(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}
int main()
{FAST
ll a,b,v,w,t;
cin>>a>>v>>b>>w>>t;
ll x=abs(a-b);
v*=t;
w*=t;
if(x+w>v)
{
	cout<<"NO\n";
}
else
{
	cout<<"YES\n";
}
return  0;
}






Measured memory_bytes: 3656
#include<iostream>
using namespace std;
int main(){
    long long N, sum = 0;
    cin >> N;
    for(int i=1;i<=N;i++){
        if(i % 3 == 0){
            continue;
        }
        if(i % 5 == 0){
            continue;
        }
        if(i % 3 != 0 and i % 5 != 0){
            sum += i;
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3592
import java.util.Scanner;
public class Main {

	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int A[]=new int[N];
		int B[]=new int[N];
		for(int i=0;i<N;i++) {
			A[i]=sc.nextInt();
			B[A[i]-1]++;
		}
		long ans=0;
		for(int i=0;i<N;i++) {
			ans+=calcNumOfCombination(B[i],2);
		}
		for(int i=0;i<N;i++) {
			System.out.println(ans-calcNumOfCombination(B[A[i]-1], 2)+calcNumOfCombination(B[A[i]-1]-1, 2));
		}

	}
	public static long calcNumOfCombination(int n, int r){
		if(n==0||n==1) {
			return 0;
		}else {
        long num = 1;
        for(int i = 1; i <= r; i++){
            num = num * (n - i + 1) / i;
        }
        return num;}
    }
}


Measured memory_bytes: 104584
#include<iostream>
using namespace std;
int main()
{
	int a[4];
	for(int i=0;i<4;i++){
		cin>>a[i];
	}
	string s="1974";
	int f=0;
	for(int i=0;i<4;i++){
		int f1=0;
		for(int j=0;j<s.length();j++){
			if(a[i]==(s[j]-'0')){
				f1=1;
				s[j]='0';
				break;
			}
		}
		if(f1==0){
			f=1;
			break;
		}
	}
	if(f==0) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;	
} 

Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]
#define GI(name) int (name);scanf("%d",&(name))
#define GI2(name1,name2) int (name1),(name2);scanf("%d %d",&(name1),&(name2))
#define GI3(name1,name2,name3) int (name1),(name2),(name3);scanf("%d %d %d",&(name1),&(name2),&(name3))
#define GVI(name,size) vector<int> (name)(size);FOR(i,(size))scanf("%d",&(name)[i])
#define MOD 1000000007

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

bool is_prime(int n){
    int s=sqrt(n)+1;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=n;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug_print(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug_print(Head head,Tail... tail){
    cerr<<to_string(head)<<" ";
    debug_print(tail...);
}

template<class... T>
void debug(T... args){
    cerr<<"["<<__LINE__<<"]: ";
    debug_print(args...);
}

void print(){
    cout<<endl;
}

template<class Head,class... Tail>
void print(Head head,Tail... tail){
    cout<<to_string(head);
    print(tail...);
}

int main(){
    GI(N);
    string S=get_str();
    int c=0;
    int ans=0;
    FOR(i,N){
        if(S[i]=='I'){
            c++;
        }else{
            c--;
        }
        ans=max(ans,c);
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
a = LIST()
b = LIST()
if sum(a) < sum(b):
    print(-1)
    exit()
dif = [0 for _ in range(n)]
for i in range(n):
    dif[i] = b[i] - a[i]
dif.sort(reverse=True)
cnt = 0
s = 0
for i in range(n):
    if dif[i] > 0:
        cnt += 1
        s += dif[i]
t = 0
for i in reversed(range(n)):
    if t >= s:
        break
    if dif[i] < 0:
        t -= dif[i]
        cnt += 1
print(cnt)

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(ll)(n);i>0;i--)
#define REP(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);


int main() {
  while (true) {
    int n;
    cin >> n;
    if (!n) {
      return 0;
    }
    vi a(n);
    rep (i, n) {
      cin >> a[i];
    }
    sort(all(a));
    int ans = inf;
    rep (i, n - 1) {
      ans = min(ans, a[i + 1] - a[i]);
    }
    cout << ans << endl;
  }
}



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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define fr(i,k) for(i=0;i<k;i++)
#define ALL(c) (c).begin(),(c).end()
#define deb(x) cerr<<#x<<"  = "<<x<<endl;
#define SZ(x) (x).size();
#define ll long long
#define MOD 1000000007
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define em emplace_back
#define ulli unsigned long long int
#define INF 1e18
#define endl "\n"
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> ii;
void solve();

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


int main() {
	fastio;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int t;
	t = 1;

	//cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}

void solve()
{
	ll n, i;
	cin >> n;

	ll a[n];

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

	vector<ll> dp(n, INT_MAX);
	dp[0] = 0;
	dp[1] = abs(a[1] - a[0]);

	for (i = 2; i < n; i++)
	{
		dp[i] = min({dp[i], dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2])});
	}

	cout << dp[n - 1] << endl;
}


Measured memory_bytes: 4756
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

pll rotate(pll a){
    swap(a.first, a.second);
    if(a.first < 0) a.first = -a.first;
    else if(a.first > 0) a.second = -a.second;
    return a;
}
ll modpow(ll a, ll b){
    ll ans = 1;
    while(b){
        if(b & 1){
            ans *= a;
            ans %= MOD;
        }
        a *= a;
        a %= MOD;
        b >>= 1;
    }
    return ans;
}
int main(){
    ll n;
    cin >> n;
    map<pll, ll> fish;
    ll zero = 0;
    for(ll i = 0; i < n; i++){
        ll a, b;
        cin >> a >> b;
        if(a == 0 && b == 0){
            zero++;
            continue;
        }
        if(a < 0){
            a = -a;
            b = -b;
        }
        else if(a == 0) b = 1;
        ll g = gcd(a, b);
        a /= g;
        b /= g;
        fish[{a, b}]++;
    }
    ll ans = 1;
    for(auto [f1, cnt1] : fish){
        pll f2 = rotate(f1);
        ll cnt2 = 0;
        auto p = fish.find(f2);
        if(p != fish.end()){
            cnt2 = p->second;
            fish.erase(p);
        }
        ans *= modpow(2, cnt1) + modpow(2, cnt2) - 1;
        ans %= MOD;
    }
    cout << (ans + zero + MOD - 1) % MOD << endl;
}

Measured memory_bytes: 15896
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> hw(h, vector<char>(w));
    rep(i, h) rep(j, w) cin >> hw[i][j];
    int dy[4] = {1, -1, 0, 0};
    int dx[4] = {0, 0, 1, -1};
    rep(i, h) rep(j, w) {
        if (hw[i][j] == '#') {
            bool flg = false;
            rep(k, 4) {
                int check_y = i + dy[k];
                int check_x = j + dx[k];
                if (check_y < 0 || check_y >= h || check_x < 0 || check_x >= w) continue;
                if (hw[check_y][check_x] == '#') {
                    flg = true;
                }
            }
            if (!flg) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>
#include<math.h>

int main(void){
  int n,s[1000]={};
  int i;
  double ave=0,a=0;
  while(1){
    ave = 0;
    a = 0;
    scanf("%d",&n);
    if(n==0)return 0;
    for(i=0;i<n;i++){
      scanf("%d",&s[i]);
      ave += s[i];
    }
    ave /= n;
    for(i=0;i<n;i++){
      a += pow(s[i]-ave,2);
    }
    a /= n;
    printf("%.4f\n",sqrt(a));
  }
  return 0;
}
		   
	       

Measured memory_bytes: 1856
package main

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

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func main() {
	io := NewIo()
	defer io.Flush()

	b := io.Next()

	if b == "A" {
		io.PrintLn("T")
	} else if b == "T" {
		io.PrintLn("A")
	} else if b == "C" {
		io.PrintLn("G")
	} else if b == "G" {
		io.PrintLn("C")
	}
}

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

#include <string.h>

using namespace std;

typedef long long ll;

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

const int MAX_S = 1000;

int solve(int (*dp)[MAX_S + 1][MAX_S + 1],
        const char *x, const int xlen, const char *y, const int ylen) {
    for (int i = 1; i <= ylen; i++) {
        for (int j = 1; j <= xlen; j++) {
            chmax((*dp)[i][j], (*dp)[i - 1][j]);
            chmax((*dp)[i][j], (*dp)[i][j - 1]);
            if (y[i - 1] == x[j - 1]) {
                chmax((*dp)[i][j], (*dp)[i - 1][j - 1] + 1);
            }
        }
    }
    return (*dp)[ylen][xlen];
}

int main(void) {
    int Q;
    char X[1010], Y[1010];
    cin >> Q;

    for (int i = 0; i < Q; i++) {
        int xlen, ylen;
        int dp[MAX_S + 1][MAX_S + 1];

        cin >> X >> Y;
        xlen = strlen(X);
        ylen = strlen(Y);
        reverse((char *) &X, X + xlen);
        reverse((char *) &Y, Y + ylen);

        for (int i = 0; i <= ylen; i++) {
            for (int j = 0; j <= xlen; j++) {
                dp[i][j] = 0;
            }
        }

        cout << solve(&dp, X, xlen, Y, ylen) << endl;
    }
    
    return 0;
}



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

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000007;

int main() {

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

	Int N;
	cin >> N;

	vector<string> s(N);
	for (Int i = 0; i < N; i++) {
		cin >> s[i];
		sort(s[i].begin(), s[i].end());
	}

	sort(s.begin(), s.end());

	Int ans = 0;
	
	Int i = 0;
	while (i < N-1) {
		Int start = i;
		Int end = 0;
		i++;

			while ( (i < N)&& (s[start] == s[i])) {
				end = i;
				i++;
			}
	

		Int j = end - start;
		while (j > 0) {
			ans += j;
			j--;

		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 5760
import sys
sys.setrecursionlimit(1000000)

MOD = 1000000007

def dfs(par, v):
    val = nColors - 1 if par == 0 else nColors - 2
    for child in edges[v]:
        if child != par:
            ways[child] = max(0, val)
            val -= 1
            dfs(v, child)

nVertices, nColors = map(int, input().split())
edges = [[] for _ in range(nVertices + 1)]
for _ in range(nVertices - 1):
    u, v = map(int, input().split())
    edges[u].append(v)
    edges[v].append(u)

ways = [0] * (nVertices + 1)
ways[1] = nColors
dfs(0, 1)
ret = 1
for w in ways[1:]:
    ret = (ret * w) % MOD
print(ret)


Measured memory_bytes: 88044
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

struct Cake {
    int h, w;
    Cake(){}
    Cake(int _h, int _w) : h(_h), w(_w) {}
};

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

    int N, W, H;
    while (cin >> N >> W >> H, W) {
        vector<Cake> cakes;
        cakes.emplace_back(H, W);

        rep(_, N) {
            int p, s;
            cin >> p >> s;
            p--;
            auto c = cakes[p];
            cakes.erase(cakes.begin() + p);
            s %= c.h + c.w;
            Cake c1, c2;
            c1 = c2 = c;
            if (s < c.w) {
                tie(c1.w, c2.w) = minmax(s, c.w - s);
            }
            else {
                s -= c.w;
                tie(c1.h, c2.h) = minmax(s, c.h - s);
            }

            cakes.emplace_back(c1);
            cakes.emplace_back(c2);
        }

        V areas;
        for (auto c : cakes) {
            areas.emplace_back(c.h * c.w);
        }

        sort(all(areas));
        rep(i, N + 1) {
            cout << areas[i] << (i == N ? '\n' : ' ');
        }
    }
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
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; }

int main(){
    int s, w;
    cin >> s >> w;
    if (w >= s){
        cout << "unsafe" << endl;
    }
    else{
        cout << "safe" << endl;
    }
}


Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <stdlib.h>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define rsort(z) sort(z.rbegin(),z.rend())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())
#define ccnt(z,w) count(z.begin(),z.end(),w)


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec2(std::vector<Int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a / gcd(a, b) *b;
	//a*bは64bit integer overflow
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}


int main() {
	int a, b, c; cin >> a ;
	//string s,t; cin >> s>>t;
	cout << a * 800 - 200 * (a / 15);

	cout << endl;
	return 0;
}

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

int main() {
  int A, B;
  int i;
  int count = 0;

  cin >> A >> B;

  for (i=A;i<=B;i++){
    if ((i/10000 == i % 10) && (i/1000 % 10 == (i / 10) % 10)){
      count++;
    }
  }

  cout << count << endl;
}

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

using namespace std;




int main(void)
{
   string A,B,C;
   char isTurn='a',ans;
   queue<char> a,b,c;

   cin>>A>>B>>C;

    for(int i=0;i<A.size();i++){
        a.push(A[i]);
    }
        for(int i=0;i<B.size();i++){
        b.push(B[i]);
    }
        for(int i=0;i<C.size();i++){
        c.push(C[i]);
    }

    bool isEnd=false;
    while(!isEnd){
        switch (isTurn)
        {
        case 'a'/* constant-expression */:
            /* code */
            if(a.size() <= 0){
                ans='A';
                isEnd=true;
            }
            isTurn = a.front();
            a.pop();
            break;
        case 'b':
            if(b.size() <= 0){
                ans='B';
                isEnd=true;
            }
            isTurn = b.front();
            b.pop();
            break;
        case 'c':
            if(c.size() <= 0){
                ans='C';
                isEnd=true;
            }
            isTurn = c.front();
            c.pop();
            break;
        
        default:
            break;
        }
    }

    cout<<ans<<endl;


 
	return 0;
}


Measured memory_bytes: 3636
N,A,B = list(map(int,input().split()))


tmp = []

for num in range(1,N+1):
    i = 0
    for n in list(str(num)):
        i += int(n)

    if A <= i <= B:
        tmp.append(num)

ans = 0

for t in tmp:
    ans += t

print(ans)   

Measured memory_bytes: 3296
package main

import "fmt"

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

	l, r, b, t := 0, w, 0, h
	var x, y, a int
	for i := 0; i < n; i++ {
		fmt.Scan(&x, &y, &a)
		switch a {
		case 1:
			l = max(l, x)
		case 2:
			r = min(r, x)
		case 3:
			b = max(b, y)
		case 4:
			t = min(t, y)
		}
	}

	if r-l < 0 || t-b < 0 {
		fmt.Println(0)
	} else {
		fmt.Println((r - l) * (t - b))
	}
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> a;
  for (long long i = 0; i < 19; i++) for (long long j = 1; j <= 9; j++) a.push_back((long long) (.5 + powl(10, i)) * j - 1);
  long long x = *(upper_bound(begin(a), end(a), n) - 1);
  int res = x % 10;
  for (int i = 0; i < 20; i++) {
    x /= 10;
    res += x % 10;
  }
  cout << res << "\n";
  return 0;   
}

Measured memory_bytes: 768
#include<stdio.h>
int main() {
    int i, n;
    long long ans = 0;
    scanf("%d", &n);
    for(i = 1; i <= n; ++i) {
        if(i % 3 && i % 5) ans += i;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1724
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}
typedef struct{
  int cur,x,y;
}T;

char maze[50][50];
bool checked[50][50];
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
int H,W;

bool isArea(int x, int y){
  return x>=0 && x<W && y>=0 && y<H && !checked[x][y] && maze[x][y] == '.';
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  cin >> H >> W;
  int count = 0;
  rep(y,H)rep(x,W){
    cin >> maze[x][y];
    if(maze[x][y] == '.')++count;
  }
  queue<T>que;
  checked[0][0] = true;
  que.push({1,0,0});
  int gx = W-1,gy = H-1;
  bool canGoal = false;
  int cur;
  while(!que.empty()){
    cur = que.front().cur;
    int x = que.front().x;
    int y = que.front().y;
    if(x==gx && y==gy){
      canGoal = true;
      break;
    }
    que.pop();
    rep(i,4){
      int nx = x+dx[i],ny = y+dy[i];
      if(!isArea(nx,ny))continue;
      checked[nx][ny] = true;
      que.push({cur+1,nx,ny});
    }
  }
  if(canGoal){
    cout << count - cur << endl;
  }else cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

int main() {
  int N; cin >> N;
  vector<bool> A(55556,true);
  vector<int> B(0);
  A[0] = A[1] = false;
  for (int i = 2; i * i <= 55555; i++) {
    if (A[i]) {
      int j = i + i;
      while (j <= 55555) {
        A[j] = false;
        j += i;
      }
    }
  }
  rep(i,55556) {
    if (A[i] && i % 10 == 1) B.push_back(i); 
  }

  rep(i,N) cout << B[i] << " ";
  cout << endl;
}

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

S_dict = {}
for i in range(N):
  S = str(input())
  S_dict[S] = S_dict.get(S,0) + 1

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

max_num = S_dict_sorted[0][1]
for i in range(len(S_dict_sorted)):
  if max_num == S_dict_sorted[i][1]:
    ans_list.append(S_dict_sorted[i][0])
  else:
    break

ans_list = sorted(ans_list)

for ans in ans_list:
  print(ans)


Measured memory_bytes: 47324
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
const int N = 4010;
int dep[N],fa[N],tag[N],f[N],flg[N],n,m,u[N],v[N],ans,tot,T[N];
vector<int> e[N];
struct node{int u,v,num;};
vector<node> E;
void dfs(int x,int dad){
	fa[x]=dad;dep[x]=dep[dad]+1;
	for(int v:e[x]) if(v!=dad) dfs(v,x);
}
int lca(int x,int y){
	while(x!=y)
		if(dep[x]>dep[y]) x=fa[x];
		else y=fa[y];
	return x;
}
void solve(int x,int dad){
	for(int v:e[x]) if(v!=dad) solve(v,x);
	vector<node> V;
	for(auto&pr:E) if(pr.u==x||pr.v==x){
		if(pr.u==pr.v){pr.u=-1;pr.v=-1;continue;}
		V.push_back(pr);pr.u=pr.v=-1;
	}
	if(x==1) return;
	ans+=min(flg[x]+(int)V.size(),2);
	T[x]=min(flg[x]+(int)V.size(),2);
	for(int i=0;i+1<V.size();i+=2){
		if(V[i].v==x) tag[V[i].num]^=1,swap(V[i].u,V[i].v);
		if(V[i+1].v==x) tag[V[i+1].num]^=1,swap(V[i+1].u,V[i+1].v);
		node p={V[i].v,V[i+1].v,++tot};
		if(p.u==x) p.u=fa[x];
		if(p.v==x) p.v=fa[x];
		f[V[i].num]=p.num;f[V[i+1].num]=p.num;
		tag[V[i].num]^=1;
		E.push_back(p);
		int z=lca(p.u,p.v),z1=lca(V[i].u,V[i].v),z2=lca(V[i+1].u,V[i+1].v);
		if(z1==z2){
			if(z1==x) z1=fa[x];
			for(int y=x;y!=z1;y=fa[y]) flg[y]+=2;
			for(int y=z;y!=z1;y=fa[y]) flg[y]+=2;
		}
		else{
			if(dep[z1]<dep[z2]) z=z2;
			else z=z1;
			for(int y=x;y!=z;y=fa[y]) flg[y]+=2;
		}
	}
	if(V.size()&1){
		auto p=V.back();
		if(p.u==x) p.u=fa[x];
		if(p.v==x) p.v=fa[x];
		E.push_back(p);
	}
}
int main(){
	read(n);read(m);
	for(int i=1;i<n;i++){
		int x,y;read(x);read(y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	dfs(1,0);
	for(int i=1;i<=m;i++){
		int x,y;read(x);read(y);
		u[i]=x;v[i]=y;
		E.push_back({x,y,i});
	}
	tot=m;
	solve(1,0);
	cout<<ans<<'\n';
	memset(flg,0,sizeof(flg));
	for(int i=1;i<=m;i++){
		int now=0,x=i;
		int z=lca(u[i],v[i]);
		for(int y=u[i];y!=z;y=fa[y]) flg[y]++;
		for(int y=v[i];y!=z;y=fa[y]) flg[y]++;
		while(x) now^=tag[x],x=f[x];
		if(now) cout<<v[i]<<' '<<u[i]<<'\n';
		else cout<<u[i]<<' '<<v[i]<<'\n';
	}
	int now=0;
	for(int i=1;i<=n;i++){
		now+=min(2,flg[i]);
	//	if(min(2,flg[i])!=T[i]) cout<<i<<' '<<flg[i]<<' '<<T[i]<<'\n';
	}
	return 0;
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin >> s;
	ll int sum = 0;
	for(int i = 0; i < s.size(); i++) {
		sum += s[i] - '0';
	}
	if(sum % 9 == 0)
		cout << "Yes";
	else
		cout << "No";
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 


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

  vector<pair<int,int> > v(n);
  for(int i=0;i<n;i++)
  {
    int x,l;
    cin >> x >> l;
    v[i] = mp(x+l,x-l);
  }

  sort(v.begin(),v.end());
  
  int cnt = 0;
  int prev = -INF-100;
  for(int i=0;i<n;i++)
  {
    if(v[i].se >= prev)
    {
      prev = v[i].fi;
      cnt++;
    }
  }

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


Measured memory_bytes: 1024
import random as rng
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)


def dump_impl(*objects):
    print(*objects, file=sys.stderr)


def dump_dummy(*objects):
    pass


dump = dump_impl if "DEBUG" in sys.argv else dump_dummy
N, M, X = map(int, input().split())
dump(N, M, X)
C = [0]*N
A = [[]]*N
dump(C, A)
for i in range(N):
    I = list(map(int, input().split()))
    dump(I)
    C[i] = I[0]
    A[i] = I[1:]
ans = -1
for p in it.product([True, False], repeat=N):
    buy = list(p)
    understand = [0]*M
    pay = 0
    for i in range(N):
        if buy[i]:
            pay += C[i]
            for j in range(M):
                understand[j] += A[i][j]
    if all([u >= X for u in understand]):
        ans = pay if ans == -1 else min(ans, pay)

print(ans)


Measured memory_bytes: 78304
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <string.h>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
int N;
int Memo[101][5][2];
int P[101][10];

int dfs(int idx, vector<int> C, bool flag){
  if (idx==5){
    if (!flag) return -INF;
    int sm = 0;
    rep(i, N){
      sm += P[i][C[i]];
    }
    return sm;
  }
  vector<int> D(N);
  int ans = -INF;
  // 午前営業
  rep(i, N){
    D[i] = C[i];
    if (Memo[i][idx][0]){
      D[i]++;
    }
  }
  ans = max(ans, dfs(idx+1, D, true));

  // 午後営業
  rep(i, N){
    D[i] = C[i];
    if (Memo[i][idx][1]){
      D[i]++;
    }
  }
  ans = max(ans, dfs(idx+1, D, true));

  // 両方営業
  rep(i, N){
    D[i] = C[i];
    if (Memo[i][idx][0]){
      D[i]++;
    }
    if (Memo[i][idx][1]){
      D[i]++;
    }
  }
  ans = max(ans, dfs(idx+1, D, true));

  // 営業しなかった
  ans = max(ans, dfs(idx+1, C, flag));
  return ans;
}

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

  cin >> N;
  rep(i, N){
    rep(j,5){
      rep(k,2){
        cin >> Memo[i][j][k];
      }
    }
  }
  rep(i, N){
    rep(j, 11){
      cin >> P[i][j];
    }
  }
  bool flag = false;
  vector<int> B(N, 0);
  int ans = dfs(0, B, flag);
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

def main():
	n, m = map(int, input().split())
	a = [0] + [i for i in map(int, input().split())]
	aa = {}
	temp = 0
	ans = 0
	for i in range(n+1):
		temp = (temp + a[i]) % m
		if temp in aa:
			ans += aa[temp]
			aa[temp] = aa[temp] + 1
		else:
			aa[temp] = 1
	print(ans)

main()

Measured memory_bytes: 14224
lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
})
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
  const N = parseInt(lines[0]);
  lines.shift();
  
  var cnt = 0;
  for (var n = 0; n < N; n++) {
    var number = parseInt(lines[n]);
    if (isPrime(number)) cnt++;
  }
  
  console.log(cnt);
});

function isPrime(number) {
    var result = true;
    if (number === 2) return true;
    if (number < 2 || number % 2 === 0) return false;

    var rootedNum = Math.sqrt(number);  // 平方根を求める
    for (var i = 3; i <= rootedNum; i += 2) {
      if (number % i === 0) return false;
    }
    
    return result;
}


Measured memory_bytes: 18900
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		boolean bl = true;
		int a=0,b=0,c=0;
		int count = 0;

		while(bl){
			a = stdIn.nextInt();
			b = stdIn.nextInt();
			c = stdIn.nextInt();

			if((a >= 1 && a <= 10000) && (b >= 1 && b <= 10000) && (c >= 1 && c <= 10000) && (a <= b)){
				break;
			}
		}
		while(a <= b){
			if(c % a == 0){
				count++;
			}
			a++;
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 26144
s = input()
q = int(input())

rev = False
before = []
after = []
for i in range(q):
  inp = list(input().split())
  if inp[0] == '1':
    rev = not rev
  else:
    f = inp[1]
    c = inp[2]
    if rev:
      if f == '1':
        f = '2'
      else:
        f = '1'
    if f == '1':
      before.append(c)
    else:
      after.append(c)
ans = ''
if rev:
  after.reverse()
  ans = ''.join(after) + s[::-1] + ''.join(before)
else:
  before.reverse()
  ans = ''.join(before) + s + ''.join(after)
print(ans)

Measured memory_bytes: 68824
#include <bits/stdc++.h>
using namespace std;
int main() {
  int H, W, N, x, y, a, x1, x2, y1, y2;
  for (cin >> W >> H >> N, x1 = 0, y1 = 0, x2 = W, y2 = H;  N; N--) {
    cin >> x >> y >> a;
    if (a == 1) {
      x1 = max(x,x1);
    } else if (a == 2) {
      x2 = min(x,x2);
    } else if (a == 3) {
      y1 = max(y,y1);
    } else {
      y2 = min(y,y2);
    }
  }
  if (x2 <= x1 || y2 <= y1) {
    cout << 0;
  } else {
    cout << (x2-x1)*(y2-y1);
  }
}

Measured memory_bytes: 256
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
#１行に数値一つならparseInt(readline())
#１行に数値複数ならparseMap(split(readline()))を行数分。
function main()
  X = parseInt(readline())
  k = lcm(X,360)/X
  println(Int(k))  
end
main()

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    set<ll> A;
    REP(i,0,N) {
        ll a;
        cin >> a;
        if(A.count(a) == 0) A.insert(a);
        else A.erase(a);
    }
    PR(SZ(A));

    return 0;
}

/*



*/

Measured memory_bytes: 8160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll ATCODER_AMARI = 1000000007; //10^9 + 7
const ll INF = 10000000000000;

//階乗関数　ATCODER_AMARIに注意
ll factorial(ll k){
  ll sum = 1;
  for(int i = 1 ; i < k + 1; i++) {
    sum *= i;
    //sum = sum % ATCODER_AMARI;
  }
  return sum;
}

int main() {
  string s,t;
  cin >> s >> t;
  int a,b;
  cin >> a >> b;
  string u;
  cin >> u;

  if(s == u) {
    cout << a - 1 << ' ' << b << endl;
  }
  else {
    cout << a << ' ' << b - 1 << endl;
  }
}



Measured memory_bytes: 3560
{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import qualified Data.Map.Strict             as Map
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector                 as VB
import qualified Data.Vector.Mutable         as VBM
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

inf :: Int
inf = 10^18

main = do
  n <- getInt
  let solve :: Int -> String -> String
      solve n res | n <= 0    = res
                  | otherwise = let n' = n - 1
                                    c = chr (ord 'a' + n' `mod` 26)
                                    res' = c : res
                                in solve (n' `div` 26) res'
  putStrLn $ solve n ""


Measured memory_bytes: 3792
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll cnt=0;
bool vis[100];
vector<pair<ll,ll>>pll;
void dfs(ll now,ll unused){
  cnt++;
  ll m=pll.size();
  for(int i=0;i<m;i++){
    if(i==unused)continue;
    if(pll[i].F==now){
      if(vis[pll[i].S]==false){
	vis[pll[i].S]=true;
	dfs(pll[i].S,unused);
	//	vis[pll[i].S]=false;
      }
    }else if(pll[i].S==now){
      if(vis[pll[i].F]==false){
	vis[pll[i].F]=true;
	dfs(pll[i].F,unused);
	//vis[pll[i].F]=false;
      }
    }
  }
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  pll.resize(m);
  ll ans=0;
  for(int i=0;i<m;i++)cin>>pll[i].F>>pll[i].S;
  for(int i=0;i<m;i++){
    cnt=0;
    for(int j=1;j<=50;j++)vis[j]=false;
    vis[1]=true;
    dfs(1,i);
    //cout<<cnt<<" "<<pll[i].F<<" "<<pll[i].S<<endl;
    if(cnt!=n){ans++;}
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e9+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

vector<ll>premier;


void sieve(ll n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (ll p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (ll i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
      for (ll p=2; p<=n; p++)
       if (prime[p]){
            premier.push_back(p);
       }

       }


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a;
    cin>>a;
    sieve(1000000);
    ll res=a;
    for(int i=0;i<premier.size();i++){
        if(premier[i]<a)continue;
        else {
            res=premier[i];
            break;
        }
    }
    cout<<res<<endl;
    return 0;

}


Measured memory_bytes: 2424
use std::io::Read;

pub fn read_stdin() -> String {
    let mut s = String::new();
    ::std::io::stdin().read_to_string(&mut s).unwrap();
    s
}

pub trait Parse {
    fn to<T>(&mut self) -> T
    where
        T: std::str::FromStr;
}

impl<'a> Parse for std::str::SplitWhitespace<'a> {
    fn to<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let word = self.next().unwrap();
        word.parse().ok().unwrap()
    }
}

fn main() {
    let source = read_stdin();
    let mut iter = source.split_whitespace();
    let n: usize = iter.to();
    let mut s0 = iter.to::<String>().chars().collect::<Vec<_>>();
    let s1 = s0.drain(..(n / 2)).collect::<Vec<_>>();
    if s0 == s1 {
        println!("Yes");
    } else {
        println!("No");
    }
}

Measured memory_bytes: 4352
N = int(input())
A_n = list(map(int,input().split()))

count =[0 for i in range(N)]
for i in range(N):
    count[A_n[i]-1] +=1
ans =[count[i]*(count[i]-1)//2 for i in range(N)]
a1=sum(ans)
for i in range(N):
    print(a1-count[A_n[i]-1]+1)

Measured memory_bytes: 26140
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

var (
	reader io.Reader = os.Stdin
	writer io.Writer = os.Stdout
)

func main() {
	reader = os.Stdin
	writer = os.Stdout
	run()
}

func run() {
	num := readIntsFromStdin()[0][0]
	result := strconv.Itoa(num * num * num)

	fmt.Fprintln(writer, result)
}

// ReadInts parses lines of inputs into 2D int array.
func readIntsFromStdin() [][]int {
	out := [][]int{}
	scanner := bufio.NewScanner(reader)

	for scanner.Scan() {
		var ints []int

		for _, s := range strings.Split(scanner.Text(), " ") {
			i, err := strconv.Atoi(s)

			if err != nil {
				fmt.Fprintln(os.Stderr, "Failed to parse string into int.", err)
				os.Exit(1)
			}

			ints = append(ints, i)
		}

		out = append(out, ints)
	}

	return out
}



Measured memory_bytes: 1136
n, t = map(int, input().split())
F = list(input())

total = 0
while F != []:
    tmp = F.pop(0)
    if F == []:
        total += n
    elif tmp == "n":
        p = F.pop(0)
        if p == "^":
            num = F.pop(0)
            total += pow(n, int(num))
        else:
            total += n

time = total * t
if time > 1000000000:
    print("TLE")
else:
    print(time)



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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve(){
	string s;
	cin  >> s;
	map<char,int> m;
	rep(i,s.length()){
		m[s[i]]++;
	}
	int count = 0;
	rep(i,26){
		if(m[(char)('a'+i)] == 0){
			P((char)('a'+i));
			return;
		}
	}
	P("None");
}

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


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

#define int long long

int32_t main() {
	string s ;
	cin >> s ;
	int cnt = 0 ;
	for(auto i : s){
		cnt += (i-'0') ;
	}
	int l = s.size() ;
	cout << max(cnt , (9*(l-1) + (s[0]-'0'-1))) ;
	
	return 0;
}

Measured memory_bytes: 256