akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
const int INF = 1e9;

int main() {
    string S;
    cin >> S;

    int ans = 0, l = 0, r = S.size() - 1;
    while (r - l > 0) {
        if (S[l] == S[r])
            ++l, --r;
        else {
            if (S[l] == 'x')
                ++l, ++ans;
            else if (S[r] == 'x')
                --r, ++ans;
            else {
                cout << -1 << endl;
                return 0;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

const int MAX_a = 100000;
vector<int> x_cand(MAX_a + 5, 0);

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        x_cand[a]++;
        if (a != 0) x_cand[a-1]++;
        x_cand[a+1]++;
    }
    int max = *max_element(x_cand.begin(), x_cand.end());
    cout << max << endl;

    return 0;
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;

void solve() {

}

int main() {
  int n, m;
  cin >> n >> m;
  cout << ( n * (n-1) / 2 + m * (m-1) / 2 ) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#include <iomanip>
#include <queue>
#include <string.h>
#include <bitset>

#define ll long long int
#define ld long double
#define rep(i,n) for(int i = 0;i < n;i++)
#define rep1(i,n) for(int i = 1;i < n;i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "
#define all(x) x.begin(),x.end()
#define allr(x) x.begin(),x.end(),greater<int>()
#define P pair<ll,ll>
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define INF 1ll << 60
#define PI 3.14159265359

using namespace std;

int main(){
	int n,k,r,s,p;
	string t;
	ll ans = 0;
	cin >> n >> k >> r >> s >> p >> t;
	for(int i = 0; i < t.size();i++){
		if(i < k){
			if(t[i] == 'r'){
				ans += p;
			}
			else if(t[i] == 's'){
				ans += r;
			}
			else{
				ans += s;
			}
		}
		else{
			if(t[i] == 'p' && t[i-k] == 'p'){
				t[i] = '?';
			}
			else if(t[i] == 's' && t[i-k] == 's'){
				t[i] = '?';
			}
			else if(t[i] == 'r' && t[i-k] == 'r'){
				t[i] = '?';
			}
			else{
				if(t[i] == 'r'){
					ans += p;
				}
				else if(t[i] == 's'){
					ans += r;
				}
				else{
					ans += s;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <vector>

using namespace std;
typedef long long LL;

const int maxn = 100005;

int ehead[maxn],ecnt;
struct edge {
	int u,v,next;
}edg[maxn*2];
void add(int u,int v) {
	edg[++ecnt]=(edge){u,v,ehead[u]};
	ehead[u]=ecnt;
	edg[++ecnt]=(edge){v,u,ehead[v]};
	ehead[v]=ecnt;
}
int ABS(int x) {return x>0?x:-x;}
int stk[maxn],top;LL w[maxn];bool Ring;
int n,m,sum[maxn],sz[maxn],vis[maxn],fa[maxn];LL ans;

void FindRing(int u)
{
	vis[u]=true;
	for (int v,j=ehead[u];j;j=edg[j].next)
	if ((v=edg[j].v)!=fa[u]) {
		if (!vis[v]) fa[v]=u,FindRing(v);
		else if (!Ring) {
			for (int i=u;i!=v;i=fa[i])
				stk[++top]=i;
			stk[++top]=v;Ring=true;
		}
	}
}
void dfs(int u,int dep)
{
	vis[u]=2;sz[u]=1;sum[u]=dep&1;
	for (int v,j=ehead[u];j;j=edg[j].next)
	if (!vis[v=edg[j].v]) {
		dfs(v,dep+1);sz[u]+=sz[v];sum[u]+=sum[v];
		ans+=ABS(sz[v]-sum[v]*2); 
	}
}

int main()
{
	#ifdef Amberframe
		freopen("agc004f.in","r",stdin);
		freopen("agc004f.out","w",stdout);
	#endif
	scanf("%d %d",&n,&m);
	for (int u,v,i=1;i<=m;i++)
		scanf("%d %d",&u,&v),add(u,v);
	if (n!=m) {
		dfs(1,0);
		if (sz[1]!=sum[1]*2) puts("-1");
		else printf("%lld",ans);
	}
	else {
		FindRing(1);
		for (int i=1;i<=n;i++) vis[i]=false;
		for (int i=1;i<=top;i++) vis[stk[i]]=true;
		for (int i=1;i<=top;i++) dfs(stk[i],i);
		if (top&1) {
			LL x=0;
			for (int i=1;i<=top;i++) {
				int u=stk[i];
				x+=sum[u]*2-sz[u];
			}
			if (x&1) puts("-1");
			else {
				x/=2;ans+=ABS(x);
				for (int i=2;i<=top;i++) {
					int u=stk[i-1];
					x-=sum[u]*2-sz[u];
					ans+=ABS(x);
				}
				printf("%lld",ans);
			}
		}
		else {
			for (int i=1;i<=top;i++) {
				int u=stk[i];
				w[i]=w[i-1]+sum[u]*2-sz[u];
			}
			if (w[top]!=0) puts("-1");
			else {
				sort(w+1,w+top+1);
				int o=w[top/2];
				for (int i=1;i<=top;i++)
					ans+=ABS(o-w[i]);
				printf("%lld",ans);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 9344
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

#[allow(unused_macros)]
macro_rules! vec_md {
    ( $ init : expr ; $ ( $ dim : expr ) ;* ) => { vec_md ! ( $ ( $ dim ) ;* => $ init ) };
    ( $ head : expr ; $ ( $ tail : expr ) ;* => $ init : expr ) => { vec ! [ vec_md ! ( $ ( $ tail ) ;* => $ init ) ; $ head ] };
    ( $ head : expr => $ init : expr ) => { vec ! [ $ init ; $ head ] };
}

#[allow(unused_macros)]
macro_rules! chmin {
    ( $ x : expr , $ y : expr ) => { if $ x > $ y { $ x = $ y ; true } else { false } };
}

fn main() {
    input! {
        n: usize, wcap: u64,
        wv: [(u64, usize); n]
    }
    let vsum = wv .iter()
        .map(|&(_, v)| v)
        .fold(0, |acc, x| acc + x);
    let mut dp = vec_md![1u64<<60;n+1;vsum+1];
    dp[0][0] = 0;
    for i in 0..n {
        let &(w, v) = &wv[i];
        for j in 0..dp[0].len() {
            if j + v < dp[0].len() {
                chmin!(dp[i+1][j+v], dp[i][j] + w);
            }
            chmin!(dp[i+1][j], dp[i][j]);
        }
    }
    let mut ret = 0;
    for i in 0..dp[0].len() {
        if dp[n][i] <= wcap {
            ret = std::cmp::max(ret, i);
        }
    }
    println!("{}", ret);
}

Measured memory_bytes: 106748
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try (Scanner sc = new Scanner(System.in)) {
           String ww = sc.next();

           int ans = 0;
           if (ww.equals("RRR") ) {
        	   ans = 3;
           } else if (ww.contains("RR")) {
        	   ans = 2;
           } else if (ww.contains("R")) {
        	   ans = 1;
           }

            System.out.println(ans);

		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}


Measured memory_bytes: 35560
package main

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

func main() {
	n, m := readInt(), readInt()
	if n == 1 && m == 1 {
		fmt.Println(1)
		return
	}
	if n == 1 || m == 1 {
		fmt.Println(max(n, m) - 2)
		return
	}
	fmt.Println(max(0, (n-2)*(m-2)))
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

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

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

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
n = int(input())
a = list(map(int, input().split()))

if 0 in a:
    print(0)
else:

    ans = 1
    for i in a:
        if i == 0:
            ans = 0
            break
        elif ans * i > 10 ** 18:
            ans = -1
            break
        else:
            ans *= i

    print(ans)


Measured memory_bytes: 21632
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

t_ = x_ = y_ = flag = 0
for i in range(input()):
    t, x, y = map(int, raw_input().split())
    if t - t_ < abs(x - x_) + abs(y - y_) or (x + y + t + x_ + y_ + t_) % 2:
        print "No"
        exit()
    t_, x_, y_ = t, x, y

print "Yes"

Measured memory_bytes: 6008
#include<iostream>
using namespace std;
#define MAX 10001
struct Node {
	int parent, id;
};
Node N[MAX];
void unite(int x, int y) {
	int p1=x,p2=y;
	while (true) {
		if (N[p1].parent == p1 && N[p2].parent==p2) break;
		else {
			p1 = N[p1].parent;
			p2 = N[p2].parent;
		}
	}
	N[p1].parent = p1;
	N[p2].parent = p1;

}
int findset(int x, int y) {
	int p1 = x, p2 = y;
	while (true) {
		if (N[p1].parent == p1 && N[p2].parent == p2) break;
		else {
			p1 = N[p1].parent;
			p2 = N[p2].parent;
		}
	}
	if (p1 == p2) return 1;
	else return 0;
}
int main() {
	int n, q, command, x, y;
	cin >> n >> q;
	for (int i = 0; i <n; i++) {
		N[i].id = i;
		N[i].parent =i;
	}
	for (int i = 0; i < q; i++) {
		cin >> command >> x >> y;
		if (command == 0) {
			unite(x, y);
		}
		else {
			cout << findset(x, y) << endl;
		}
	}
}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int main() {
    int n; string s;
    cin >> n >> s;
    int w[n + 1], e[n + 1];
    fill_n(w, n + 1, 0); fill_n(e, n + 1, 0);
    rep(i, n) {
        if (s[i] == 'W') w[i + 1] = w[i] + 1;
        else w[i + 1] = w[i];
    }
    for (int i = n; i >= 1; --i) {
        if (s[i - 1] == 'E') e[i - 1] = e[i] + 1;
        else e[i - 1] = e[i];
    }
    int ans = inf;
    rep(i, n) {
        chmin(ans, w[i] + e[i + 1]); // ホワイトボードに書いて確かめた
    }
    out(ans);
}


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

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++) cin >> a[i];
    vector<int> ans;
    if(n%2==1){
        for(int i=0;i<n;i++){
            if(i%2==0){
                auto it=ans.begin();
                ans.insert(it,a[i]);
            }else{
                ans.push_back(a[i]);
            }
        }
    }else{
        for(int i=0;i<n;i++){
            if(i%2==0){
                ans.push_back(a[i]);
            }else{
                auto it=ans.begin();
                ans.insert(it,a[i]);
            }
        }
    }
    for(int i=0;i<n;i++){
        cout << ans[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 3828
#include<bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
      int n;
      cin>>n;
      int k;
      while(n>0)
      {
          k=n%10;
          n/=10;
          if(k==7)
          return cout<<"Yes",0;
      }
      cout<<"No";
  }
  return 0;
}

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

int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);
    string st;
    cin >> st;
    int sum=0;
    for(auto i:st)
    	sum+=(i-'0');
    if(sum%9==0)cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
#define N_PRIME 1000000007
#define ll int64_t

void calc(){
    int w,h;
    int board[32][32];
    bool moved[32][32];
    int px,py;
    
    cin >> w >> h;
    if( w == 0 && h == 0)exit(0);
    for(int j = 0 ; j < h ;j++ ){
        string s;
        cin >> s;
        for(int i = 0 ; i < w ; i++ ){
            moved[i][j] = false;
            
            if( s[i] == '.' ){
                board[i][j] = 1;
            }else if(s[i] == '#' ){
                board[i][j] = 2;
            }else if(s[i] == '@' ){
                px = i;
                py = j;
                board[i][j] = 1;
            }
        }
    }
    
    int count = 0;
    queue<int> xs;
    queue<int> ys;
    xs.push(px);
    ys.push(py);
    
    while(xs.size()>0){
        px = xs.front();
        py = ys.front();
        xs.pop();
        ys.pop();
        
        if( px < 0 || w <= px || py < 0 || h <= py )
            continue;
        
        if( moved[px][py] )
            continue;
        moved[px][py] = true;
        
        if( board[px][py] == 2 )
            continue;

        xs.push(px + 1 );
        ys.push(py + 0 );
        
        
        xs.push(px + 0 );
        ys.push(py + 1 );
        
        
        xs.push(px - 1 );
        ys.push(py + 0 );
        
        
        xs.push(px + 0 );
        ys.push(py - 1 );
        count++;
    }
    
    cout << count << endl;
}

int main(void){
    while(true)calc();
    return 0;
}

Measured memory_bytes: 3152
/*
 * AtCode Beginner Contest 137 : B.One Clue
 * Author : anaksoleh
 * 18 August 2019
 *
 */


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

int K,X;

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

	cin>>K>>X;

	int range = K - 1;
	int low = X - range , high = X + range;

	for(int i = low ; i <= high ; i++){
		cout << i;
		if(i != high) cout << " ";
	}
	cout << '\n';

	return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007

int main() {

	int N, M;
	cin >> N >> M;
	VI X(M), sa(M - 1);
	REP(i, M)cin >> X[i];

	if (N >= M)cout << 0 << endl;
	else{
		SORT(X);
		int len;
		len = abs(X[0] - X[M - 1]);
		REP(i, M - 1) {
			sa[i] = X[i + 1] - X[i];
		}
		sort(sa.begin(),sa.end());
		for (int i = 0; i < N - 1; i++)len -= sa[sa.size() - 1 - i];
		cout << len << endl;
	}
	END:

	return 0;
}


Measured memory_bytes: 1024
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll A, B;
    cin >> A >> B;
    vector<vector<char>> ans(100, vector<char>(100));
    for (ll i = 0; i < 100; i++) {
        for (ll j = 0; j < 100; j++) {
            ans[i][j] = (i < 50 ? '#' : '.');
        }
    }
    A--; B--;

    for (ll i = 0; i < 50; i += 2) {
        for (ll j = 0; j < 100; j += 2) {
            if (A == 0) {
                i = 50;
                break;
            }

            ans[i][j] = '.';
            A--;
        }
    }
    for (ll i = 51; i < 100; i += 2) {
        for (ll j = 0; j < 100; j += 2) {
            if (B == 0) {
                i = 100;
                break;
            }

            ans[i][j] = '#';
            B--;
        }
    }

    cout << "100 100" << endl;
    for (ll i = 0; i < 100; i++) {
        for (ll j = 0; j < 100; j++) {
            printf("%c", ans[i][j]);
        }
        printf("\n");
    }
}

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

using namespace std;

struct Node
{
    string s;
    int i,p;

    Node (string s,int i,int p) : s(s),i(i),p(p) {}
};

bool func (Node n1,Node n2)
{
    if(n1.s == n2.s)
        return n1.p>n2.p;

    return n1.s < n2.s;
}

int main()
{
    int n;
    cin>>n;
    int i;
    vector<Node>V;

    for(i=0;i!=n;i++)
    {
        string s;
        int p;

        cin>>s>>p;

        V.push_back(Node(s,i+1,p));
    }

    sort(V.begin(),V.end(),func);

    for(i=0;i!=n;i++)
        cout<<V[i].i<<'\n';

    return 0;
}

Measured memory_bytes: 3664
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
//int mp[1000000001];
int main(){
    int n;
    int answer=0;
    cin >> n;
    map<int,int>mp;

    REP(i,n){
        int tmp;
        cin >> tmp;
        mp[tmp]++;
    }
    for(std::map<int,int>::iterator it = mp.begin(); it != mp.end(); it++){
        if((*it).second<(*it).first)answer+=(*it).second;
        else{
            answer+=(*it).second-(*it).first;
        }
    }
    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 4736
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
using namespace std;
typedef long long ll;
const int maxn = 55;
const int inf = 1000000007;

int n;
ll a[maxn];

int main() {
  //freopen("in.cpp","r",stdin);
  cin>>n;
  for(int i=0; i<n; i++)cin>>a[i];
  ll ret=0,sum2=0;
  while(1) {
    sum2=0;
    for(int i=0; i<n; i++) {
      sum2+=a[i]/n;
    }
    //cout<<sum2<<endl;
    if(sum2==0)break;
    ret+=sum2;
    for(int i=0; i<n; i++) {
      a[i]=a[i]%n+sum2-a[i]/n;
      //cout<<i<<" "<<a[i]<<endl;
    }
  }
  cout<<ret<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int N, K;
int A[2010][2010] = {};

int main() {
    cin >> N >> K;
    for(int i=0; i<N; ++i) {
        int x, y; char c;
        cin >> x >> y >> c;
        if(c == 'W') x += K;
        x %= (2 * K); y %= (2 * K);
        A[x + 1][y + 1] += 1;
    }

    for(int i=1; i<=2*K; ++i) {
        for(int j=1; j<=2*K; ++j) {
            A[i][j] += A[i][j - 1];
        }
    }
    for(int i=1; i<=2*K; ++i) {
        for(int j=1; j<=2*K; ++j) {
            A[i][j] += A[i - 1][j];
        }
    }

    int res = 0;
    for(int i=1; i<=K; ++i) {
        for(int j=1; j<=K; ++j) {
            int tmp = 0;
            tmp += A[i - 1][j - 1];
            tmp += A[2 * K][j - 1] - A[i + K - 1][j - 1];
            tmp += A[i - 1][2 * K] - A[i - 1][j + K - 1];
            tmp += A[2 * K][2 * K] - A[i + K - 1][2 * K] - A[2 * K][j + K - 1] + A[i + K - 1][j + K - 1];
            tmp += A[i + K - 1][j + K - 1] - A[i - 1][j + K - 1] - A[i + K - 1][j - 1] + A[i - 1][j - 1];
            res = max(res, tmp);
            res = max(res, N - tmp);
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 16128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int x = Integer.parseInt(str[1]);

		str = br.readLine().split(" ");

		long a[] = new long[n];
		long ans = 0;

		for (int i = 0; i < n; i++) {
			a[i] = Long.parseLong(str[i]);
			if (a[i] > x) {
				ans += a[i] - x;
				a[i] = x;
			}
		}

		for (int i = 1; i < n; i++) {
			if (a[i - 1] + a[i] > x) {
				ans += (a[i - 1] + a[i]) - x;
				a[i] -= (a[i - 1] + a[i]) - x;
			}
		}
		System.out.println(ans);

	}
}

Measured memory_bytes: 48288
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define endl '\n'
#define el cout << endl
#define long long long
#define oo 1000000

const int N = 1e6;
int n;

int main()
{
    //freopen("test.inp", "r", stdin);
    //freopen("test.out", "w", stdout);
    ios_base::sync_with_stdio(false);
    int m, l, r, ll, rr;
    cin >> n >> m >> ll >> rr;
    rep(i, m-1)
    {
        int l, r;
        cin >> l >> r;
        if (l <= rr)
        {
            ll = max(ll, l);
            rr = min(rr, r);
        }
        else {cout << 0; return 0;}
    }
    cout << rr - ll + 1;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
typedef long long ll;
using namespace std;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main() {
   ll n, k;
   cin >> n >> k;
   vector<ll> v(n);
   for (int i = 0; i < n; i++) cin >> v[i];
 
   ll ans = 0;
   for (int i = 0; i < n; i++) {
     ll migi = 0, zentai = 0;
     for (int j = i; j < n; j++)
       if (v[i] > v[j]) migi++;
     for (int j = 0; j < n; j++)
       if (v[i] > v[j]) zentai++;
 
     ans += migi * k % MOD;
     ans %= MOD;
     ans += (k - 1) * k / 2 % MOD * zentai % MOD;
     ans %= MOD;
   }
   cout << ans << endl;
 }

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

const ll mod = 1000000007;
string in;
ll n;
ll dp[5005][5005];

ll modexp(ll b, ll e, ll m){
    ll r = 1;
    while(e > 0){
        if((e & 1) == 1){
            r = (r * b) % m;
        }
        e = e / 2;
        b = (b * b) % m;
    }
    return r;
}

int main(){
    cin >> n >> in;
    int p = in.size();

    dp[0][0] = 1;
    for(int x = 1 ; x <= n; x++){
        for(int y = 0 ; y <= n; y++){
            if(y != 0) dp[x][y] += (dp[x - 1][y - 1] * 2) % mod;
            else dp[x][y] += dp[x - 1][y];
            dp[x][y] += dp[x - 1][y + 1];
            dp[x][y] %= mod;

            //printf("haha %d %d %lld\n",x,y,dp[x][y]);     
        }
    }
    ll ans = dp[n][p];
    ll now = modexp(2,mod - 2, mod);

    for(int x = 1; x <= p; x++){
        ans = (ans * now) % mod;
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 195712
h, w = gets.chomp.split(" ").map(&:to_i)
s = Array.new
h.times { s.push(gets.chomp.split(""))}

white = 0
for i in 0..h-1 do
    for j in 0..w-1 do
        white += 1 if s[i][j] == "."
    end
end

c = Array.new(h).map{Array.new(w,10000000)}

def wfs(s, c, x, y, v)
    return if x < 0 || x >= s.size || y < 0 || y >= s[0].size
    return if s[x][y] == "#"
    return if c[x][y] <= v
    c[x][y] = v
    wfs(s, c, x, y+1, v+1)
    wfs(s, c, x, y-1, v+1)
    wfs(s, c, x+1, y, v+1)
    wfs(s, c, x-1, y, v+1)
end

wfs(s, c, 0, 0, 1)

if c[h-1][w-1] == 10000000 then
    puts -1
else
    puts white - c[h-1][w-1]
end



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

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 100010
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve2(void)
{
  int a,b;cin>>a>>b;
  if(a == b)
  {
    cout<<2*a  -2 <<endl;
    return;
  }
    int lim = a*b - 1;
    int l = 1,r = I32_MAX;
    while(abs(l - r) > 1)
    {
      int mid = (l + r)/2;
      int mul = (mid + 1)/2 * (mid + 1 - (mid +1)/2);//積の最大値がこれ
      if(mul > lim) r = mid;
      else l = mid;
      // DEBUG(mul,mid,"\n");
  }
  cout<<l-1<<endl;

}
void solve(void)
{
  int q;cin>>q;
  for (int lq = 0; lq < q; lq++)
  {
    solve2();
  }
  
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U& u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
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; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	ll ans = 0;
	REP(i, N-1) {
		ans += i + 1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
//#define sort(nums) sort(nums.begin(),nums.end())
#include <bits/stdc++.h>
#define mod 1000000007
#define deb(x) cout<<#x<<" "<<x<<endl
using namespace std;
using ll = long long int;

void jets(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


int main(){
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
    jets();
    string x, y;
    int m,n;
    cin>>x>>y;
    m=x.length();
    n=y.length();
    int dp[m+1][n+1];
    memset(dp,0,sizeof(dp));
    for(int i=1;i<m+1;i++){
    	for(int j=1;j<n+1;j++){
    		if(x[i-1]==y[j-1])
    			dp[i][j]=1 + dp[i-1][j-1];
    		else
    			dp[i][j]=0 + max(dp[i-1][j],dp[i][j-1]);
    	}
    }
    string s="";
    int i=m,j=n;
    while(i>0 && j>0){
    	if(x[i-1]==y[j-1]){
    		s.push_back(x[i-1]);
    		i--,j--;
    	}
    	else{
    		if(dp[i-1][j]>dp[i][j-1])
    			i--;
    		else
    			j--;
    	}
    }
    reverse(s.begin(), s.end());
    cout<<s<<endl;

    return 0;
}

Measured memory_bytes: 38800
import sys
N = int(input())
p = list(map(int, input().split()))
p_ = sorted(p)

if p == p_:
  print("YES")
  sys.exit()

for i in range(N):
  for j in range(i+1, N):
    a = p[i]
    p[i] = p[j]
    p[j] = a
    if p == p_:
      print("YES")
      break
    else:
      b = p[i]
      p[i] = p[j]
      p[j] = b
      continue
  else:
    continue
  break
else:
  print("NO")

Measured memory_bytes: 38768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
const int INF = 1e9;
struct SegmentTree {
private:
    int n;
    vector<int> node;
 
public:
    SegmentTree() {
        int sz = 200010;
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, -INF);
        for(int i=0; i<sz; i++) node[i+n-1] = -INF;
        for(int i=n-2; i>=0; i--) node[i] = max(node[2*i+1], node[2*i+2]);
    }
 
    void update(int x, int val) {
        x += (n - 1);
        node[x] = val;
        while(x > 0) {
            x = (x - 1) / 2;
            node[x] = max(node[2*x+1], node[2*x+2]);
        }
    }
    // hannkaikukann 
    int getmax(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(r <= a || b <= l) return -INF;
        if(a <= l && r <= b) return node[k];
 
        int vl = getmax(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmax(a, b, 2*k+2, (l+r)/2, r);
        return max(vl, vr);
    }
};

//const ll mod = 1000000007;
int N;
SegmentTree seg;
vector<ll> paths[201000];
ll ans[201000];
vector<int> a;
void dfs(int now, int p) {
    ll tmp = seg.getmax(0, a[now]);
    tmp++;
    ll before = seg.getmax(a[now], a[now]+1);
    chmax(tmp, before);
    seg.update(a[now], tmp);
    ans[now] = seg.getmax(0, N + 1);
    for(auto to : paths[now]) {
        if(to == p) continue;
        dfs(to, now);
    }
    seg.update(a[now], before);
}

int main() {
  ll X;
  cin >> X;
  ll a = 100;
  ll t = 0;
  while(true) {
    a += a / 100;
    t++;
    if(a >= X) break;
  }
  cout << t << endl;
    return 0;
}

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




Measured memory_bytes: 2104
# Q1
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

L, R, d = LI()

total = 0
for i in range(L, R + 1):
    if i % d == 0:
        total += 1

print(total)

Measured memory_bytes: 9092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define t(x) cerr<<#x<<":"<<x<<'\n';
#define t2(a,n) { cerr<<#a<<" = "; for(int i=0; i<n; ++i){ cerr << a[i] << ' '; } ; cerr <<'\n'; }
#define t3(a){ cerr<<#a<<" = "; for(auto i: a){ cerr<<i<<" "; } cerr<<'\n'; }


unordered_set<ll> items;

void factors(ll x){
  for(int i=2; i<=sqrt(x)+1; ++i){
    if( x % i == 0 ){
      items.insert(i);
      items.insert(x/i);
    }
  }
  items.insert(x);
}
set<int> visited;
unordered_map<int,int> dp;
bool check(ll n, ll item){
  if( n < item ){
    return n == 1;
  }
  if( visited.find(item) != visited.end() ){
    return dp[item];
  }
  dp[item] =  n % item == 0 ? check(n/item, item) : check(n%item, item);
  visited.insert(item);
  return dp[item];
}

void print(ll n){
  factors(n-1);
  factors(n);
  int ans = 0;
  for(auto i : items){
		if( i >= 2 ){
			ans += check(n, i);	
		}
  }
  cout<<ans<<'\n';
}

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

  ll n;
  cin>>n;
  print(n);


  #ifdef LOL
      cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  #endif
  return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)









int f(int p, int x){
    return p * (100 + x) / 100;
}

int main(){
    int x, y, s;
    while(cin >> x >> y >> s, x, y, s){
        int ans = 0;
        for(int i = 1; i < s; i++){
            for(int j = 1; j < s; j++){
                if(f(i, x) + f(j, x) == s){
                    ans = max(ans, f(i, y) + f(j, y));
                }
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>                                                                               
using namespace std;
#define FOR(v1, v2) for (v1 = 0; v1 < v2; ++v1)
#define FORE(v1, v2) for (v1 = 0; v1 <= v2; ++v1)
#define FORO(v1, v2) for (v1 = 1; v1 < v2; ++v1)
#define FOROE(v1, v2) for (v1 = 1; v1 <= v2; ++v1)
using ll = long long;
constexpr ll kMod = 1'000'000'007;


ll is_pof_2(ll x) {
  return ceil(log2(x)) == floor(log2(x));
}

ll next_pof_2(ll x) {
  if (is_pof_2(x)) {
    return x << 1;
  }
  return pow(2, ceil(log(x)/log(2)));
}

int main () {
  ll h;
  cin >> h;
  cout << next_pof_2(h) - 1;
  return 0;
}

Measured memory_bytes: 512
n, k = map(int, input().split())
cnt = 0
val = k
for i in range(n):
    if val > n:
        break
    val *= k
    cnt += 1
    #print(k)
    #print(val)
    if val > n:
        break
    #print(cnt)
    #print(i)
    #print(val)
print(cnt+1)

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

int main() {
    int N; cin >> N;
    long long l1 = 2, l2 = 1, tmp;
    if (N == 1) {
        cout << l2 << endl;
        return 0;
    }
    for (int i = 1; i < N; i++) {
        tmp = l2;
        l2 += l1;
        l1 = tmp;
    }
    cout << l2 << endl;
}

Measured memory_bytes: 3572
import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline



def acinput():
    return list(map(int, input().split(" ")))


def II():
    return int(input())

directions=np.array([[1,0],[0,1],[-1,0],[0,-1]])
directions = list(map(np.array, directions))

mod = 10**9+7


def nCr(n, r):
    """
    Calculate the number of combination (nCr = nPr/r!).
    The parameters need to meet the condition of n >= r >= 0.
    It returns 1 if r == 0, which means there is one pattern
    to choice 0 items out of the number of n.
    """
    if n<r:
        return 0
    # 10C7 = 10C3
    r = min(r, n-r)

    # Calculate the numerator.
    numerator = 1
    for i in range(n, n-r, -1):
        numerator *= i

    # Calculate the denominator. Should use math.factorial?
    denominator = 1
    for i in range(r, 1, -1):
        denominator *= i

    return numerator // denominator


N,M=acinput()

print(nCr(N,2)+nCr(M,2))



Measured memory_bytes: 12640
#include <bits/stdc++.h>
#include <string>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
const int INF = 1001001001;


int main() {
  string S, T;
  cin >> S >> T;
  int A, B;
  cin >> A >> B;
  string U;
  cin >> U;

  if (U == S) {
    A--;
  } else {
    B--;
  }
  
  cout << A << " " << B << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(50) << setiosflags(ios::fixed);
  int a, b;
  cin >> a >> b;
  if (a < b)
    cout << "a < b" << endl;
  else if (a > b)
    cout << "a > b" << endl;
  else
    cout << "a == b" << endl;
  return 0;
}



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

  int n,m;
  cin >> n >> m;

  vector <int> fri,a;
  fri.resize(n);
  for(int i=0;i<n;i++) fri[i] = 0;
  a.resize(m);
  
  for(int i=0;i<m;i++) cin >> a[i];

  int t;
  for(int i=0;i<m;i++) {
    for(int j=0;j<n;j++) {
      cin >> t;
      if(a[i] == t) fri[j]++;
      else fri[a[i]-1]++;
    }
  }

  for(int i=0;i<n;i++) cout << fri[i] << endl;

  return 0;

}
 

Measured memory_bytes: 1200
n,d=map(int,input().split())
l = [list(map(int,input().split())) for _ in range(n)] #複数行複数入力を多重リストに
ans=0
for i in l:
    dis=(i[0]**2+i[1]**2)**0.5
    if dis<=d:
        ans+=1
print(ans)

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

int main() {
  string s;
  cin >> s;
  long long ans = 0;
  if (s.length() == 1) {
    cout << stoi(s);
    return 0;
  }
  for (int i = 0; i < (1 << s.length() - 1); ++i) {
    long long res = 0;
    int prev = 0;
    for (int j = 0; j < s.length() - 1; ++j) {
      if (i & (1 << j)) {
        res += stoll(s.substr(prev, j - prev + 1));
        prev = j + 1;
      }
    }
    res += stoll(s.substr(prev, s.length() - prev));
    ans += res;
  }
  cout << ans << endl;
}


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

#define V vector
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

typedef V<int> vi;
typedef V<ll> vll;
typedef V<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define prec(x) cout<<fixed<<setprecision(x)
#define f(i,a) for(int i = 0 ; i < a ; i++)
#define ff first
#define ss second
#define all(x) (x).begin() ,(x).end()

#define pb push_back
#define mp make_pair
#define numberofdigits(x) floor(log10(x)) + 1

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

void solve()
{
	int x;
	cin >> x;

	int cnt = 0;

	for (int i = 400 ; i <= 2000 ; i += 200)
	{
		cnt++;

		if (x >= i and x <= i + 199)
			break;
	}

	cout << 9 - cnt << "\n";


}


int main() {


	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);


	int t = 1;
	//cin >> t;

	while (t--)
	{
		solve();
	}

	return 0;
}





Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef bool boolean;

#define pii pair<int, int>

const int N = 5e4 + 5;
const int M = 1e5 + 5;

int n, m, type;
char ans[M];
int us[M], vs[M];

namespace subtask1 {

	bitset<N> f[M];
	boolean vis[M];
	int h[N], A[M], B[M];

	void F(int p, int x) {
		if (!p || vis[p]) {
			return;
		}
		vis[p] = true;
		if (x == us[p]) {
			F(A[p], x);
			F(B[p], vs[p]);
		} else {
			ans[p] = 'v';
			F(B[p], x);
			F(A[p], us[p]);
		}
	}

	void solve() {
		for (int i = 1, u, v; i <= m; i++) {
			u = us[i], v = vs[i];
			if (!h[u]) {
				f[i].set(u);	
			} else {
				f[i] = f[h[u]]; 
			}
			swap(u, v);
			if (!h[u]) {
				f[i].set(u);	
			} else {
				f[i] |= f[h[u]]; 
			}
			swap(u, v);
			A[i] = h[u], B[i] = h[v];
			h[u] = h[v] = i;
		}
		for (int i = 1; i <= m; i++)
			ans[i] = '^';
		for (int i = 1; i <= m; i++) {
			if ((signed) f[i].count() == n) {
				F(i, us[i]);
				puts(ans + 1);
				return;
			}
		}
		puts("-1");
	}

}

namespace subtask2 {
	
	const int C = 4;

	int h[C];
	int nxt[M][C];
	bitset<C> vis[M][2];

	boolean dfs(int p, int x, int y) {
		if (x == y) {
			return false;
		}
		if (p == m + 1) {
			return true;
		}
		int sx = -1, sy = -1;
		if (x == us[p] || y == us[p]) {
			sx = 0, sy = x ^ y ^ us[p];
		} else {
			sx = 1, sy = x ^ y ^ vs[p];
		}
		if (vis[p][sx].test(sy))
			return false;
		vis[p][sx].set(sy);

		// down
		int nx = (x == us[p]) ? vs[p] : x;
		int ny = (y == us[p]) ? vs[p] : y;
		if (dfs(min(nxt[p][nx], nxt[p][ny]), nx, ny)) {
			ans[p] = 'v';
			return true;
		}

		nx = (x == vs[p]) ? us[p] : x;
		ny = (y == vs[p]) ? us[p] : y;
		if (dfs(min(nxt[p][nx], nxt[p][ny]), nx, ny)) {
			ans[p] = '^';
			return true;
		}
		return false;
	}

	void solve() {
		if (n == 2) {
			puts("-1");
			return;
		}
		for (int i = 1; i <= m; i++)
			ans[i] = '^';
		for (int i = 1; i <= n; i++)
			h[i] = m + 1;
		for (int i = m; i; i--) {
			if (vs[i] > 3)
				continue;
			memcpy(nxt[i], h, sizeof(h));
			h[us[i]] = h[vs[i]] = i;
		}
		n = 3;
		for (int i = 1; i <= n; i++) {
			for (int j = i + 1; j <= n; j++) {
				if (dfs(min(h[i], h[j]), i, j)) {
					puts(ans + 1);
					return;
				}
			}
		}
		puts("-1");
	}

}

int main() {
	scanf("%d%d%d", &n, &m, &type);
	for (int i = 1; i <= m; i++) {
		scanf("%d%d", us + i, vs + i);;
	}
	if (type == 1) {
		subtask1::solve();
	} else {
		subtask2::solve();
	}
	return 0;
}


Measured memory_bytes: 615168
#include <stdio.h>

int main(void){
  long long S;
  scanf("%lld", &S);
  long long INF = 1000000000LL;

  if(S ==  INF*INF) printf("0 0 0 %lld %lld 0", INF, INF);
  else printf("0 0 1 %lld %lld %lld\n", INF, S/INF+1, INF-S%INF);

  return 0;
}

Measured memory_bytes: 128