akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline std::ostream& operator << (std::ostream& out, const std::vector<T>& v) {
    if (v.empty())return out;
    constexpr bool is_vector_v = is_vector<T>::value;
    if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
    else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
    return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

int main(){
    IOS;
    int n;
    cin >> n;
    string s;
    cin >> s;
    int res = 0;
    int tmp = 0;
    REP(i,n){
        if(s[i]=='I'){
            tmp++;
        }else{
            tmp--;
        }
        chmax(res,tmp);
    }
    put(res);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int t1[25];   // Number
float t2[25]; // Time
int i;
int run[6];   // Group 1st,2nd List
int z=0;      // Run index

int fast(float bef, float aft){
  if(bef<aft)
    return 0;    // before_fast = 0
  return 1;      // after_fast = 1
}

void pick(int s, int g, int f1){
  int st_n=0, nd_n=0;     // 1st,2nd Number
  float st_t=50, nd_t=50; // 1st,2nd Time
  int f2;
  
  for(i=s;i<=g;i++){    // s->g
    //first check
    if(fast(st_t,t2[i])){  // after fast = true
      f2=1;    //init
      if(f1){   //Run List Flag
	int j;
	for(j=0;j<6;j++){
	  if(run[j]==t1[i])
	    f2=0;  //No Count
	}
      }
      // 2nd=1st 1st=new
      if(f2){
	nd_n=st_n;
	nd_t=st_t;
	st_n=t1[i];
	st_t=t2[i];
      }
    }
    //second check
    else if(fast(nd_t,t2[i])){  // after fast = true
      f2=1;
      if(f1){   //Run List Flag
	int j;
	for(j=0;j<6;j++){
	  if(run[j]==t1[i])
	    f2=0;
	}
      }
      //2nd=new
      if(f2){
	nd_n=t1[i];
	nd_t=t2[i];
      }
    }
  }
  //Output
  printf("%d %.2f\n%d %.2f\n",st_n,st_t,nd_n,nd_t);
  //Run Log
  run[z++]=st_n;  //Group Run 1st Resist
  run[z++]=nd_n;  //Group Run 2nd Resist
}

int main(){

  //Scan Input
  for(i=1;i<25;i++) //1-24
    scanf("%d%f",&t1[i],&t2[i]);

  //pickup 2*4=8members
  pick( 1, 8,0);
  pick( 9,16,0);
  pick(17,24,0);
  pick( 1,24,1);
  
  return 0;
}

Measured memory_bytes: 0
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//String tmp = sc.next();
		//int tmp = sc.nextInt();
		//Long tmp = sc.nextLong();
      int N = sc.nextInt();
      int K = sc.nextInt();
      System.out.println(N - K + 1);
	}
}


Measured memory_bytes: 21204
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;
        static void Main(string[] args)
        {
            var NK = Sarray();
            var N = NK[0];
            var K = NK[1];
            var H = Sarray();

            var ans = H.Count(h => h >= K);
            WriteLine(ans);
        }
    }
}

Measured memory_bytes: 20576
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ll long long
#define P pair<int,int>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
const int INF = 2002002002;
const ll LLINF = 9009009009009009009;
using namespace std;

int main() {
    fast_io
    int n, k;
    cin >> n>> k;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    sort(p.begin(), p.end());
    int ans = 0;
    rep(i,k) {
        ans += p[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;

uint solve(string& s)
{
    uint ret = 0;
    for (auto&& c : s) {
        ret += c - '0';
    }

    return ret;
}

int main()
{
    while (true) {
        string s;
        cin >> s;

        if (s == "0") {
            break;
        }

        cout << solve(s) << endl;
    }
}



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

ll gcd(ll x, ll y) {
	if (x > y) swap(x, y);
	if (y%x == 0) return x;
	else return gcd(y%x, x);
}

int main() {
	ll x, y;
	cin >> x >> y;
	cout << gcd(x, y) << endl;
	return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define int long long int
#define ll long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bn begin()
#define en end()
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define mod 1000000007
#define pi 3.141592653589
using namespace std;

int power(int x, int y) ;
int gcd(int a, int b) ;

signed main() {
    quickie
    int n ;
    cin >> n ;
    if(n >= 400 && n <600) cout << 8 << "\n" ;
    else if(n >= 600 && n < 800) cout << 7 << "\n" ;
    else if(n >= 800 && n < 1000) cout << 6 << "\n" ;
    else if(n >= 1000 && n < 1200) cout << 5 << "\n" ;
    else if(n >= 1200 && n < 1400) cout << 4 << "\n" ;
    else if(n >= 1400 && n < 1600) cout << 3 << "\n" ;
    else if(n >= 1600 && n < 1800) cout << 2 << "\n" ;
    else if(n >= 1800 && n < 2000) cout << 1 << "\n" ;
}

int power(int x, int y) {
    int res = 1; x %= mod;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res%mod;
}

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


Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main()
    {
    // スペース区切りの整数の入力
    int x,y,faise;
    cin >> x >> y >> faise;
    
    int timer = faise;
    while (timer > 0)
    {
        // xのターン
        if ( (x % 2) == 1 )
        {
            x--;    
        }
        y += x/2;
        x /= 2;
        
        // チェックだお
        // cout << timer << "回目：" << x << " " << y << endl;
        
        timer--;
        if (timer <= 0)
        {
            break;
        }
                
        // yのターン
        if ( (y % 2) == 1 )
        {
            y-=1;    
        }
        
        x += y/2;
        y /= 2;
        timer--;
        
        // チェックだお
        // cout << timer << "回目：" << x << " " << y << endl;
    }

    // 出力
    cout << x << " " << y << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

ll choose(ll n, ll a)
{
    ll x = 1, y = 1;
    rep(i, a)
    {
        x *= n - i;
        y *= i + 1;
    }
    return x / y;
}


int main(){
    int N;
    ll m = 0, a = 0, r = 0, c = 0, h = 0;
    ll D[5];
    int P[10] = {0,0,0,0,0,0,1,1,1,2};
    int Q[10] = {1,1,1,2,2,3,2,2,3,3};
    int R[10] = {2,3,4,3,4,4,3,4,4,4};

    cin >> N;
    for(int i = 0; i < N; i++){
        string S;
        cin >> S;
        if(S[0] == 'M') m++;
        if(S[0] == 'A') a++;
        if(S[0] == 'R') r++;
        if(S[0] == 'C') c++;
        if(S[0] == 'H') h++;
    }
    D[0] = m, D[1] = a, D[2] = r, D[3] = c, D[4] = h;
    ll res = 0;
    for(int i = 0; i < 10; i++){
        res += D[P[i]] * D[Q[i]] * D[R[i]];
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
# import math
from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

s = input()
print(s[:3])


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

static const int INF = 1e9+7;

int main(){
    int N,K;
    cin>>N>>K;
    vector<int> H(N);
    vector<int> dp(100010,INF);
    for(int i=0; i<N; i++){
        cin>>H[i];
    }

    dp[0] = 0;

    for(int i=0; i<N; i++){
        for(int j=1; j<=K; j++){
            dp[i+j] = min(dp[i+j],dp[i]+abs(H[i+j]-H[i]));
        }   
    }

    cout<<dp[N-1]<<endl;

    return 0;
}

Measured memory_bytes: 1024
#! /bin/bash

read ashimoto_no_paanou

if echo $ashimoto_no_paanou | grep -e "^\([RUD][LUD]\)*$" -e "^\([RUD][LUD]\)*[RUD]$" >/dev/null 2>&1 ;then
  echo "Yes"
else
  echo "No"
fi


Measured memory_bytes: 668
#include<stdio.h>

void Swap(long long int *,long long int *);
int Euclidean(long long int x,long long int y);

int main(){

  long long int x,y;
  int result;
  int i;

  scanf("%lld %lld",&x,&y);

  if(x>y){
    Swap(&x,&y);
  }
 
  result=Euclidean(x,y);

  printf("%d\n",result);

  return 0;
}

void Swap(long long int *x,long long int *y){
  long long int keep;
  keep=*x;
  *x=*y;
  *y=keep;
  return;
}

int Euclidean(long long int x,long long int y){
  long long int keep;

  while(1){
    keep=y;
    y=x%y;
    x=keep;
    if(y==0)break;
  }
  return x;
}

Measured memory_bytes: 596
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define mp make_pair
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    int n, m, x[112345];

    vector<P> v;

    cin >> n >> m;

    REP(i, m)
    cin >> x[i];

    if (n >= m)
    {
        cout << 0 << endl;
        return 0;
    }

    n = min(n, m);

    sort(x, x + m);

    for (int i = 0; i < m - 1; i++)
    {
        v.push_back(make_pair(x[i + 1] - x[i], i));
    }

    SORT(v);

    V s;

    for (int i = 0; i < n - 1; i++)
        s.push_back(v[m - 2 - i].second);

    SORT(s);

    int res = 0;

    int p = x[0];

    for (int i = 0; i < n - 1; i++)
    {
        res += x[s[i]] - p;

        p = x[s[i] + 1];
    }

    res += x[m - 1] - p;

    cout << res << endl;

    return 0;
}

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

int main() {
  int N, T;
  cin >> N >> T;
  int ans = 1001;
  for (int i = 0; i < N; i++) {
    int c, t;
    cin >> c >> t;
    if (t <= T) ans = min(c, ans);
  }
  if (ans == 1001) cout << "TLE" << endl; else  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 #define mod 1000000007
 #define f first
 #define se second
 #define pb push_back
 #define int long long int
using namespace std;
 signed main()
 {
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);cout.tie(NULL);
     
    

         
         string x;
         cin>>x;

         int n = x.size();

         int a =0;
         for(int i=0;i<n;i++)
         {
            if(x[i]=='o')
                a++;
         }

         if(15-n+a >=8)
            cout<<"YES\n";
         else
            cout<<"NO\n";


 }


Measured memory_bytes: 256
#include <stdio.h>
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
using namespace rel_ops;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

int main() {
#ifdef LOCAL
    freopen("in", "r", stdin);
    //freopen("out", "w", stdout);
#endif
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, t;
    cin >> n >> t;
    vi a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    ll res = t;
    for (int i = 0; i < n - 1; i++) {
        res += t;
        if (a[i + 1] - a[i] < t)
            res -= t - (a[i + 1] - a[i]);
    }
    
    cout << res << endl;

    return 0;
}

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

int T, card[16];

bool is_same_number(int a,int b,int c) {
  return (a == b) && (b == c);
}

bool is_sequence(int a,int b,int c) {
  return (a+2 == b+1) && (b+1 == c);
}

bool is_good_set(int a,int b,int c) {
  return is_same_number(a,b,c) || is_sequence(a,b,c);
}

bool is_all_good_set() {
  return is_good_set(card[0],card[1],card[2]) &&
    is_good_set(card[3],card[4],card[5]) &&
    is_good_set(card[6],card[7],card[8]);
}

int win() {
  sort(card,card+9);
  do {
    if (is_all_good_set()) {
      return 1;
    }
  } while (next_permutation(card,card+9));
  return 0;
}

/* for test
int main() {
  cout << is_same_number(3, 4, 5) << endl;
  cout << is_same_number(3, 3, 3) << endl;
  cout << is_sequence(3, 4, 5) << endl;
  cout << is_sequence(3, 3, 3) << endl;  
  cout << is_good_set(3, 4, 5) << endl;  
  cout << is_good_set(3, 3, 3) << endl;  
}
*/

int main() {
  cin >> T;
  for (int t=0;t<T;t++) {
    for (int i=0;i<9;i++) {
      cin >> card[i];
      //cout << card[i];
    }
    //cout << endl;
    string color;
    for(int i=0;i<9;i++) {
      cin >> color;
      //cout << color;
      if (color == "G") {
	card[i] += 10;
      } else if (color == "B") {
	card[i] += 20;
      }
      // cout << card[i];
    }
    cout << win() << endl;
    //cout << endl;
  }
}

Measured memory_bytes: 1220
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
n,m=map(int,input().split())
s=list(input())
t=list(input())
g=gcd(n,m)
a=n//g
b=m//g
judge=True
for i in range(g):
    if s[a*i]!=t[b*i]:
        judge=False
        break
print(g*a*b) if judge else print(-1)
#print(len(text))


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

ll INF = 1e+18;
int iINF = 1e9;
int MAXI = 1e8 + 1;

int 
main()
{
  int N; cin >> N;
  vector<int> arr(N);
  rep(i, 0, N) cin >> arr[i];

  vector<int> dp(N, iINF);
  dp[0] = 0;
  dp[1] = abs(arr[1] - arr[0]);

  rep(i, 2, N){
    if(dp[i] > dp[i - 1] + abs(arr[i] - arr[i - 1])) dp[i] = dp[i - 1] + abs(arr[i - 1] - arr[i]);
    if(dp[i] > dp[i - 2] + abs(arr[i] - arr[i - 2])) dp[i] = dp[i - 2] + abs(arr[i - 2] - arr[i]);
  }

  cout << dp[N - 1] << endl;

}

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

constexpr int inf = 1e9;
constexpr ll linf = 1e18;

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

    int n; ll W; cin >> n >> W;
    int V = 0;
    vector<int> v(n);
    vector<ll>  w(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i] >> w[i];
        V += v[i];
    }

    vector<vector<ll>> dp(n + 1, vector<ll>(V + 1, linf));
    dp[0][0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j <= V; j++) {
            if (j < v[i]) dp[i + 1][j] = dp[i][j];
            else dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
        }
    }
    int ans = 0;
    for (int i = 0; i <= V; i++) {
        if (dp[n][i] <= W) ans = i;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 10712
package main

import (
	"fmt"
	"log"
)

func solution(n, a, b int64) int64 {
	d := n % (a + b)

	c := n / (a + b)

	log.Printf("c: %d, d: %d", c, d)
	if d > a {
		return a * (c + 1)
	} else if d < a {
		return a*c + d
	}
	return a * c
}

func main() {
	var n, a, b int64
	fmt.Scan(&n, &a, &b)
	fmt.Println(solution(n, a, b))
}


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

using namespace std;
typedef long long ll;

#define pb push_back
#define mp make_pair
#define mem(a) memset(a,0,sizeof(a))

const int mn=1e5+5;
const int mod=1e9+7;

int n,k;
int a[mn];

int main(){
	scanf("%d%d",&n,&k);
	printf("%d\n",(n+k-3)/(k-1));
    return 0;
}


Measured memory_bytes: 256
import queue

while True :
    w,h = map(int,input().split())
    if w==0 and h ==0 :
        break
    maze = [input() for _ in range(h)]
    visited = [[-1]*w for _ in range(h)]
    for i in range(h):
        if "@"  in  maze[i]:
            x_f = i
    for i in range(w):
        if maze[x_f][i] =="@":
            y_f = i
    visited[x_f][y_f] = 1
    q = queue.Queue()
    q.put([x_f,y_f])
    cnt  = 1
    while  not q.empty():
        x,y = q.get()
        for dx,dy in [(1,0),(-1,0),(0,1),(0,-1)]:
            if 0<= x+dx < h and 0<= y+dy < w:
                if visited[x+dx][y+dy] == -1 and maze[x+dx][y+dy]=='.':
                    cnt += 1
                    visited[x+dx][y+dy] = 1
                    q.put([x+dx,y+dy])
    print(cnt)

            


Measured memory_bytes: 6848
#include <bits/stdc++.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/irange.hpp>
using namespace std;
using boost::irange;
using boost::algorithm::join;

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========

int main(int argc, char** argv) {
  int N;
  cin >> N;

  vii A(N); // 人iでx人いた
  for (int i=0; i<N; i++) {
    int x;
    cin >> x;
    A[i] = make_pair(i+1, x);
  }

  sort(begin(A), end(A),
       [](const pii& lhs, const pii& rhs) {
         return lhs.second < rhs.second;
       });

  for (int i=0; i<N; i++) {
    cout << A[i].first;
    if (i<N-1) {
      cout << " ";
    }
  }
  cout << endl;


  return 0;
}


Measured memory_bytes: 1664
W, a, b = list(map(int, input().split()))
#if (a > b) a, b = b, a
if(a < b):
    d = b - (a + W)
    if(d <= 0):
        print("0")
    else:
        print(d)
elif(a > b):
    d = a - (b + W)
    if(d <= 0):
        print("0")
    else:
        print(d)

elif(a == b):
    print("0")
    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

ll dp[101][5][2];
int main(void) {
    string s;
    ll m;
    cin >> s >> m;
    ll n = s.size();

    dp[0][0][0] = 1;
    REP(i, n) REP(j, m+1) REP(k, 2) {
        ll lim = k==1 ? 9 : s[i]-'0';
        REP(d, lim+1) {
            ll nj = min(4LL, j+(d!=0));
            dp[i+1][nj][k||d<lim] += dp[i][j][k];
        }
    }
    cout << dp[n][m][0]+dp[n][m][1] << endl;

    return 0;
}

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

#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

const int INF=1LL<<55;
const int MOD=1000000007;

bool state[1001];
vi ans(1001);
int target;


void dfs(int depth, int pre, int maxv ){
  if ( pre == target ){
    ans[target] = min( ans[target], depth );
    return;
  }
  if ( depth >= ans[target] ) return;
  
  int next, d = 0, p = maxv;
  
  while( p < target ){d++; p *= 2;}
  if ( depth + d >= ans[target] ) return;
  
  for ( int i = 1; i <= maxv; i++ ){
    if ( !state[i] ) continue;
    next = pre + i;
    if ( next <= 1000 && !state[next] ){
      state[next] = true;
      dfs(depth+1, next, max(maxv, next));
      state[next] = false;
    }
    next = ( pre > i ) ? ( pre - i ) : (i - pre);
    if ( !state[next] ){
      state[next] = true;
      dfs(depth+1, next, max(maxv, next));
      state[next] = false;
    }
  }
}

void solve(){
    for(int i=0;i<=1000;i++) state[i]=false;
    state[1]=true;
    dfs(0,1,1);
    cout<<ans[target]<<endl;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    fill(all(ans),13);
    while(cin>>target,target){
        solve();
    }

    return 0;
}


Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ans = 0;
    rep(i,n) ans += a[i]-1;
    cout << ans << endl;
}


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

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define REP2(i,n) for(int i=0;i<(int)(n);i++)
#define REP3(i,m,n) for(int i=m;i<(int)(n);i++)
#define REP4(i,m,n,s) for(int i=m;(s>0 and i<(int)(n)) or (s<0 and i>(int)(n));i+=s)
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REPIT(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define PIS(x) printf("%d ",x)
#define PRINTIA(a,n) REP(i,n){printf("%d ", *((a)+i));}putchar('\n');
#define PN() putchar('\n')
#define MP make_pair
#define PB push_back

typedef pair<int,int> PII;
typedef long long LL;
typedef unsigned long long ULL;

void RI() {}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}
void PI() {putchar('\n');}
template<typename... T>
void PI(const int head, T... tail ) {
    printf("%d ", head);
    PI(tail...);
}

#define MAX_N 100005

int ans = INT_MAX;

void cut2(int A0, int H, int W) {
    int A[3];
    A[0] = A0;
    A[1] = H/2 * W;
    A[2] = (H-H/2) * W;
    sort(A, A+3);
    ans = min(ans, A[2] - A[0]);
}

void cut3(int H, int W) {
    int A0;
    A0 = (H/3) * W;
    cut2(A0, H-H/3, W);
    cut2(A0, W, H-H/3);

    A0 = (H/3+1) * W;
    cut2(A0, H-H/3-1, W);
    cut2(A0, W, H-H/3-1);
}

int main()
{
    int H, W;
    RI(H, W);

    cut3(H, W);
    cut3(W, H);

    PI(ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define Endl endl
#define mod  1000000007
#define mkp make_pair
#define pb push_back
#define cin(n) scanf("%d",&n)
#define cout(n) printf("%d ",n)
#define sf(n) scanf("%d",&n)
#define pf(n) printf("%d ",n)
#define bitget(n) __builtin_popcountll(n)
#define maxi 500111

ll dx[] = {1,1,0,-1,-1,-1,0,1};
ll dy[] = {0,-1,-1,-1,0,1,1,1};
ll dxx[] = {1,-1,0,0};
ll dyy[] = {0,0,-1,1};
ll modexpo(ll x,ll y){if(y==0)return 1;if(y%2){ll viky=modexpo(x,y/2);
return (((x*viky)%mod)*viky)%mod;}else{ll viky=modexpo(x,y/2);return (viky*viky)%mod;
}}
ll intpoint(ll x1, ll y1, ll x2, ll y2) { return ( __gcd(abs(x1-x2),abs(y1-y2))+1); }
bool isvalid(ll x,ll y,ll n,ll m) { return (x>=0&&x<n&&y>=0&&y<m); }
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// int pp = uniform_int_distribution<int>(0, kk-1)(rng);
// ---------------------///////////////---------------------------------
// ---------------------///////////////----------------------------------
// -------------/////////////////---------------------------------///////



int main() {
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    // ll n;
    // cin>>n;

    // ll ap[n+11];
    // for(ll i=0;i<n;i++){
    //   cin>>ap[i];
    // }

    ll a,b,c;
    cin>>a>>b>>c;

    cout<<min(c,b/a);
    
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#include <time.h>
typedef std::pair<int,int> P;
using namespace std;
using ll = long long;




int main(){
    double r;
    cin >> r;
    double pi = 3.14159265358979323846;
    double ans = 2*pi*r;
    printf ("%.10f",ans);


}









Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  string S;
  cin>>S;
  ll ans=0;
  for(ll i=0;i<3;i++) {
    ll count=0;
if(S[i]=='R') {
count++;
  for(ll j=i+1;j<3;j++) {
if(S[j]=='R') {
count++;
}
    else {
break;
    }
  }
  ans=max(ans,count);
}
  }
  
  cout<<ans<<endl;
}
  

Measured memory_bytes: 3616
n = int(input())
a = [int(x) for x in input().split()]

abs_a = list(map(abs, a))
sm_abs_a = sum(abs_a)
min_a = min(abs(a[i]) for i in range(len(a)))

cnt = 0
for i in range(len(a)):
    if a[i] < 0:
        cnt += 1

if cnt%2 == 0:
    print(sm_abs_a)
else:
    print(sm_abs_a - min_a*2) 

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3
#define mod 1000000007

int N,M,T;
int W[303];
int D[303];
int G[1001];
vector<int> S[1001];

int main(){
  cin>>N>>M>>T;
  T--;
  rep(i,N)cin>>W[i];
  rep(i,M){
    cin>>G[i];
    G[i]--;
    int k;
    cin>>k;
    while(k--){
      int s;
      cin>>s;
      s--;
      S[i].push_back(s);
    }
  }
  rep(i,N){
    if(W[i])D[i]=1;
    else D[i]=INF;
  }
  rep(i,N){
    rep(j,M){
      vector<int> ss=S[j];
      sort(all(ss),[=](const int& a,const int& b){return D[a] > D[b];});
      int d=0;
      rep(k,ss.size()){
        maxch(d,k+D[ss[k]]);
      }
      minch(D[G[j]],d);
    }
  }
  if(D[T]==INF)cout<<-1<<endl;
  else cout<<D[T]<<endl;
  return 0;
}



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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","w",stdout);
    //FILE *fptr2=freopen("out.txt","w",stdout);

    char c;
    cin>>c;
    if(isupper(c))
    cout<<"A";
    else cout<<"a";

    return 0;
}


Measured memory_bytes: 3648
int main()
{
  int n;
  scanf("%d", &n);
  char s[n];
  scanf("%s", s);
  int i, cnt = 1;
  for (i = 0; i + 1 < n; i++)
  {
    if (s[i] != s[i + 1])
      cnt++;
  }
  printf("%d", cnt);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<vector<Int> > G(n);
  for(Int i=1;i<n;i++){
    Int x,y;
    cin>>x>>y;
    x--;y--;
    G[x].emplace_back(y);
    G[y].emplace_back(x);
  }
  
  function<Int(Int, Int) > dfs=
    [&](Int v,Int p)->Int{
      Int res=0;
      for(Int u:G[v])
        if(u!=p) res^=dfs(u,v)+1;
      return res;
    };
  
  cout<<(dfs(0,-1)?"Alice":"Bob")<<endl;
  return 0;
}


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

int main() {
	long long l, r, mn = 100000;
	cin >> l >> r;
	if ((r - l) >= 2040)
	{
		cout << 0;
		return 0;
	}
	else
	{
		for (long long i = l; i < r; i++)
		{
			for (long long j = l + 1; j <= r; j++)
			{
				if (i * j % 2019 < mn) mn = i * j % 2019;
			}
		}
	}
	cout << mn;
	return 0;
}

Measured memory_bytes: 256
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s = input()

if s=='RRR':
    print(3)
elif 'RR' in s:
    print(2)
elif s=='SSS':
    print(0)
else:
    print(1)

Measured memory_bytes: 8996
#include <bits/stdc++.h>
#include <tuple>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

ll gcd(ll a, ll b)
{
  return b ? gcd(b, a % b) : a;
}

int main()
{
  int n;
  cin >> n;
  vector<ll> a(n);
  for (auto &e : a)
    cin >> e;

  sort(a.begin(), a.end());
  ll ans = a[0];
  for (int i = 1; i < n; ++i)
  {
    ans = min(ans, gcd(ans, a[i]));
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
	public static void main(String args[] ) {
		Scanner sc = new Scanner(System.in);
		
		int d = sc.nextInt();
		int g = sc.nextInt();
		int[] p = new int[d];
		int[] c = new int[d];
		int[] s = new int[d];
		
		for( int i = 0; i < d; i++ ) {
			p[i] = sc.nextInt();
			c[i] = sc.nextInt();
			s[i] = p[i] * 100 * (i+1) + c[i];
		}
		
		int ans = 0;
		for( int i = 0; i < d; i++ )
			ans += p[i];
		
		for( int i = 0; i < (1<<d); i++ ) {
			int sum = 0;
			int s1 = 0;
			int num = 0;
			for( int j = 0; j < d; j++ ) {
				if( (1&(i>>j)) == 1 ) { 
					sum += s[j];
					num += p[j];
				}
				else
					s1 = j;
			}
			if( sum < g ) {
				int need = (int)Math.ceil((double)(g - sum)/(100 * (s1+1)));
				if( need < p[s1] )
					ans = Math.min(ans, num+need);
			}
			else
				ans = Math.min(ans, num);
		}
		System.out.println( ans );
		
		sc.close();
	}
}

Measured memory_bytes: 35680
using System;


namespace ConsoleApplication18
{
    class Program
    {
        static void Main(string[] args)
        {
            String s = Console.ReadLine();
            string[] ss = s.Split(' ');
            int a = int.Parse(ss[0]);
            int b = int.Parse(ss[1]);

            int d = a / b;
            int r = a % b;
            double f = (double) a / b ;

            Console.WriteLine("{0} {1} {2:f5}", d, r, f);

        }
    }
}

Measured memory_bytes: 9060
import sys
import random
import math

def is_prime(q,k=50):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

def solve():
    N = int(input())
    if is_prime(N):
        print(N-1)
        sys.exit()
    
    sq = int(math.sqrt(N))
    for i in range(sq, 1, -1):
        if N % i == 0:
            print(i+N//i-2)
            sys.exit()

if __name__ == '__main__':
    solve()

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

int main()
{
    int i,n,a,m,s=0;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>a;
        s+=a;
    }
    if(s<=n)
    {
        printf("%d\n",n-s);
    }
    else
    {
        printf("-1\n");
    }
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define ft first
#define sd second
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,char> pcc;
typedef pair<long long,long long> pll;

bool cmp(const pair<pair<string,int>,int> &a, pair<pair<string,int>,int> &b){
    if(a.ft.ft == b.ft.ft){
        return a.ft.sd > b.ft.sd;
    }
    else return a.ft.ft < b.ft.ft;
}

int main() {
    fastIO;
    int n, aux;
    string s;
    vector<pair<pair<string,int>,int>> lista;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> s >> aux;
        lista.pb({{s,aux},i+1});
    }
    sort(lista.begin(), lista.end(), cmp);
    for(int i = 0; i < n; i++){
        cout << lista[i].sd << endl;
    }
    return 0;
}



Measured memory_bytes: 3584
/*
2020-05-05
atcoder ABC
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

int main() {
    int N, M, X, ans = INF;
    cin >> N >> M >> X;
    vector<vector<int>> data(N, vector<int>(M + 1));

    rep(i, N){
        int C;
        cin >> C;
        data[i][0] = C;
        rep(j, M){
            int A;
            cin >> A;
            data[i][j + 1] = A;
        }
    }

    for (int bit = 0; bit < (1<<N); ++bit) {
        vector<int> S;
        for (int i = 0; i < N; ++i) {
            if (bit & (1<<i)) {
                S.push_back(i);
            }
        }
        vector<int> memo(M);
        int total = 0;
        bool isOK = true;
        for (int i = 0; i < (int)S.size(); ++i) {
            for(int j = 0; j < M; j++){
                memo[j] += data[S[i]][j + 1];
            }
            total += data[S[i]][0];
        }
        for(int i = 0; i < M; i++){
            if(memo[i] < X){
                isOK = false;
                break;
            }
        }
        if(isOK){
            ans = min(ans, total);
        }
    }
    
    if(ans == INF){
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int a[200010],b[1000005],p,n,m,ans;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i],b[a[i]]++;
	for(int i=1;i<=n;i++){
		b[a[i-1]]++,b[a[i]]--;
		int fl=1;
		for(int j=1;j*j<=a[i];j++)
		    if(a[i]%j==0){
		    	if(b[j]>0||b[a[i]/j]>0){
		    		fl=0;break;
		    	}
		    }
		if(fl)ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 8336
#include<bits/extc++.h>
#ifdef _debug 
#define dout(i) cout << #i << ' ' << i << ' '
#else 
#include<bits/stdc++.h>
#define dout(i) 0&&0
#endif
#pragma GCC optimize("unroll-loops,no-stack-protector,O3")
#define rep0(_i, _n) for(int _i = 0, _l = _n; (_i)<(_l) ;++_i)
#define rep1(_i, _n) for(int _i = 1, _l = _n; (_i)<=(_l) ;++_i)
#define rans(i) (cout << ((i)?"Yes" : "No") << '\n')
#define eout(i) {cout << (i) << '\n';exit(0);}
#define rout(i) {return cout << (i) << '\n', 0;}
#define priority_queue __gnu_pbds::priority_queue
#define unordered_map __gnu_pbds::gp_hash_table
#define multi int _T;for(cin >> _T;_T--;)
using namespace std;
using ll = long long;using ull = unsigned long long;using ul = unsigned;using db = double;
using __gnu_pbds::null_type;
template<typename T> void read(T begin, T end){while(begin != end)cin >> *begin, ++begin;}
template<typename T> void write(T begin, T end){while(begin != end)cout << *begin << " \n"[next(begin) == end], ++begin;}
template<typename T> using rbtree = __gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<typename T> inline ostream& operator << (ostream &ou, const vector<T> &a){for(auto it = a.begin();it != a.end();++it)ou << (it != a.begin() ? " " : "") << *it;return ou;}
template<typename T1, typename T2>inline istream& operator >> (istream &in, pair<T1, T2> &a){return in >> a.first >> a.second;}
template<typename T1, typename T2>inline ostream& operator << (ostream &ou, const pair<T1, T2> &b){return ou << b.first << ' ' << b.second;}
template<typename T> inline long long pow(long long v, long long t, const T &p){long long res = 1;for(;t;t >>= 1, v = v * v % p)if(t & 1)res = res * v % p;return res;}
const int maxn = 300010;
int n;
vector<int> a, b;
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n;
	a.resize(n), b.resize(n);
	read(a.begin(), a.end()), read(b.begin(), b.end());
	vector<int> sa(a), sb(b), pos(n);
	sort(sa.begin(), sa.end()), sort(sb.begin(), sb.end());
	for(int i = 0;i < n;++i)if(sa[i] > sb[i])rout("No");		
	for(int i = 1;i < n;++i)if(sa[i] <= sb[i-1])rout("Yes");
	for(int i = 0;i < n;++i)a[i] = lower_bound(sa.begin(), sa.end(), a[i]) - sa.begin();
	for(int i = 0;i < n;++i)b[i] = lower_bound(sb.begin(), sb.end(), b[i]) - sb.begin();
	rep0(i, n)pos[b[i]] = i;
	rep0(i, n)a[i] = pos[a[i]];
	int cnt = 0;
	rep0(i, n){
		while(a[i] != i)++cnt, swap(a[i], a[a[i]]);
	}	
	rans(cnt <= n-2);
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define all(x) x.begin(),x.end()
#define pb push_back
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define endl "\n"
const ll maxn = 2 * (1e5 + 5);

int main()
{
    fastio;
    ll i, j, k, t, n, m;

    cin>>t;
    n=8;
    if (t>=40 && t<=599){
        cout<<n<<endl;
    }
    else if (t>=600 && t<=799)
        cout<<n-1<<endl;

     
    else if (   t>=  800 && t<=999)
        cout<<n-2<<endl;

    else if ( t>=    1000 && t<=1199)
        cout<<n-3<<endl;

    else if ( t>=1200 && t<=1399)
        cout<<n-4<<endl;
    else if (t>=1400 && t<=1599)
        cout<<n-5<<endl;
    else if (t>=1600 && t<=1799)
        cout<<n-6<<endl;

    else if (
     t>=1800 && t<=1999 )
        cout<<n-7<<endl;

    return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int n, m, k;
V< V<int> > edges;
V< V<int> > block;
V<int> deg;

struct UnionFind {
    vector<int> par, cnt;

    UnionFind(int n): par(n, -1), cnt(n) {}
    int find(int x) {
        if (par[x]<0) return x;
        return par[x] = find(par[x]);
    }
    bool same(int i, int j) {
        // iとjが同じグループかどうかを判別する
        return find(i) == find(j);
    }
    int size(int x) {
        return -par[find(x)];
    }

    bool unite(int x, int y) {
        // iとjを併合する
        x = find(x);
        y = find(y);
        bool ok = (-par[x]>cnt[x] || -par[y]>cnt[y]);
        if (x == y) {
            cnt[x]++;
        } else if (par[x] > par[y]) {
            par[y] += par[x];
            par[x] = y;
            cnt[y] += cnt[x]+1;
        } else {
            par[x] += par[y];
            par[y] = x;
            cnt[x] += cnt[y]+1;
        }
        return ok;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m >> k;
    edges.resize(n);
    block.resize(n);
    deg.resize(n, 0);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        a--, b--;
        edges[a].emplace_back(b);
        edges[b].emplace_back(a);
        deg[a]++, deg[b]++;
    }
    for (int i = 0; i < k; i++) {
        int c, d; cin >> c >> d;
        c--, d--;
        block[c].emplace_back(d);
        block[d].emplace_back(c);
    }

    UnionFind uni(n);
    for (int i = 0; i < n; i++) {
        for (int e: edges[i]) {
            uni.unite(i, e);
        }
    }

    for (int i = 0; i < n; i++) {
        for (int e: block[i]) {
            if (uni.same(i, e)) deg[i]++;
        }
    }

    for (int i = 0; i < n; i++) cout << uni.size(i) - deg[i] - 1 << (i == n - 1 ? '\n' : ' ');
    return 0;
}


Measured memory_bytes: 13048
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("+-++");
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("-+--");
            //-2
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("----");
            //-4
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        string S = InputList[0];
        Console.WriteLine(S.Count(X => X == '+') - S.Count(X => X == '-'));
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b / gcd(a,b);}

int main() {
    int n;
    cin >> n;
    for(int i=n; i<=999; ++i) {
        string s = to_string(i);
        if (s[0] == s[1] && s[1] == s[2]) {
            cout << i << "\n";
            break;
        }
    }
}


Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<list>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
#define MK make_pair
const ll E=1e18+7;
const ll MOD=1000000007;





int main(){
    ll q;
    cin>>q;
    set<string> S;
    while(q--){
        string com,s;
        cin>>com>>s;
        if(com=="insert"){
            S.insert(s);
        }
        else{
            if(S.find(s)!=S.end()){
                cout<<"yes"<<endl;
            }
            else{
                cout<<"no"<<endl;
            }
        }
    }
    
    
    return 0;
}



Measured memory_bytes: 32132