akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define  unmap  unordered_map<int,int>
#define	 unset	unordered_set<int>
#define  maxpq  priority_queue<int>
#define  minpq  priority_queue<int, vector<int>, greater<int>>
#define ll long long
#define fs first
#define ss second//typedef second ss;
#define fora(i,n) for(int i=0;i<n;i++)
#define endl "\n"
using namespace std;

int main(){
	fastio;
	int n;cin>>n;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int ans = 0;
  for(int i=0;i<n;i+=2){
    if(a[i] %2){
      ans++;
    }
  }
  cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3600
#include<stdio.h>
#include<string.h>
int main(){
  char s[110],b[10010];
  int n,x,a='A',i,j;
  j=a;
  for(i=0;i<26;i++){
    s[i]=j;
    j++;
  }
  j=a;
  for(i=26;i<52;i++){
    s[i]=j;
    j++;
  }
  scanf("%d\n%s\n",&n,b);
  x=strlen(b);
  for(i=0;i<x;i++){
    for(j=0;j<26;j++){
      if(s[j]==b[i]){
        printf("%c",s[j+n]);
        break;
      }
    }
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 128
n = int(input())
s = list(input())
p = 0

for i in range(1,n):
    a = list(s[0:i])
    a = list(set(a))
    b = list(s[i:])
    t = 0
    for j in range(len(a)):
        if a[j] in b:
            t += 1
    p = max(t,p)

print(p)

Measured memory_bytes: 9088
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
void output(char c, int n) {
	rep(i, 0, n)printf("%c", c);
}
int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	output('U', ty - sy);
	output('R', tx - sx);
	output('D', ty - sy);
	output('L', tx - sx + 1);
	output('U', ty - sy + 1);
	output('R', tx - sx + 1);
	output('D', 1);
	output('R', 1);
	output('D', ty - sy + 1);
	output('L', tx - sx + 1);
	output('U', 1);
	puts("");
	return 0;
}


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

int search(vector<long> a, int n, int key) {
	int i = 0;
	a.push_back(key);
	while (a[i] != key)i++;
	return i != n;
}

int main() {
	bool ok = false;
	string s, t;
	cin >> s >> t;
	for (int i = 0; i < (int)s.size(); i++) {
		if (s == t) {
			ok = !ok;
			break;
		}
		s.push_back(s[0]);
		s.erase(s.begin());
	}
	if (ok)cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
# ume 20/03/18

def main():
  l,r=map(int,input().split())
  if r-l>2018:
    return 0
  else:
    c=2019
    for i in range(l,r):
      for j in range(i+1,r+1):
        c=min(c,i*j%2019)
        if c==0: return c
    return c

if __name__ == '__main__':
  print(main())

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<map>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define INF = 1000000100;

long long N;
int main(){
    cin >> N;
    map<int,int> mp;
    long long now=N;
    for(int i=2;i<=sqrt(N);i++){
        while(now%i==0){
            now /= i;
            mp[i]+=1;
        }
    }
    if(now!=1) mp[now] =1;
    /*
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        cout << itr->first << " " << itr->second << endl;
    }
    */
    int sum=0;
    for(auto itr=mp.begin();itr!=mp.end();itr++){
        int p=itr->second;
        for(int i=1;i<=itr->second;i++){
            if(p-i>i){
                p = p-i;
                sum++;
            }
            else{
                sum++;
                break;
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define X first
#define Y second

using namespace std;
typedef long long llint;

const int maxn = 2e5+10;
const int base = 31337;
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int logo = 18;
const int off = 1 << logo;
const int treesiz = off << 1;

string a;
int main() {
	cin >> a;
	
	int sol = 0;
	for (int i = 0; i < (a.size() + 1) / 2; i++) {
		if (a[i] != a[a.size() - 1 - i]) sol++;
	}
	cout << sol;
	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  cout << A.at(N-1)-A.at(0) << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
   int n,a,b;
   cin >> n >> a >> b;
   int ans = 0;
   for(int i = 1; i <= n; i++)
   {
       int x = i;
       int keta = 0;
       while(x > 0){
           keta += x%10;
           x /= 10;
       }
       if (keta <= b && keta >= a) {
           ans += i;
       }
   }
   cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str;
    int h,m;
    while(true){
      str = sc.next();
      if(str.equals("-")) break;
      m = sc.nextInt();
      for(;m>0;m--){
           h = sc.nextInt();
           String a,b;
           a = str.substring(0,h);
           b = str.substring(h);
           str = b + a;
        }
      System.out.println(str);
    }
    sc.close();
  }
}


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

int main(){
  int q,t,b;
  cin >> q >> t;
  map<int,bool>deta;
  map<int,int>pena;
  string s;
  int ac=0,pe=0;
  for(int i=0;i<t;i++){
    cin >> b >> s;
    if(!deta[b]){
      if(s=="WA"){
        deta[b]=false;
        pena[b]++;
      }else{
        deta[b]=true;
        ac++;
        pe+=pena[b];
      }
    }
  }
  cout << ac << " " << pe << endl;
  return 0;
}

Measured memory_bytes: 12976
/* _________________________________________________________________________________________________
  |                                                                                                 |
  |                             Author      : Aditya Ahuja                                          |
  |                             Date        : Thu, 20th Jun 2019                                    |
  |_________________________________________________________________________________________________|
*/
 
#include<bits/stdc++.h>
using namespace std;

// #define int long long

#define pb          push_back
#define F           first
#define S           second
#define rep(i,a,b)  for(int i=a; i<b; i++)
#define all(a)      (a).begin(),(a).end()
#define ret(x)      {cout << (x) << endl; return;}
#define sz(x)       (int)x.size()
#define type(x)     typeid(x).name()

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

#define wa(x)       cout << (#x) << " -------- " << (x) << endl
#define pvi(v)      {for(auto it:v) cout << it << " "; cout << endl;}
#define line1	    printf("---------------------------\n")

// #define wa //
// #define line1 //
// #define pvi //
// #define printf //

void solve();
signed main() {
	//ios_base::sync_with_stdio(false); cin.tie(NULL);
	////cout << fixed << setprecision(10);

	int t=1; 
	//cin>>t;
	while(t--) solve();
	return 0;
}

//___________________________________________________________________________________________________

void solve() {

	int n;
	cin>>n;

	vi a(3);
	vi dp(3,0);
	vi new_dp(3,0);

	rep(ii,0,n){

		cin >> a[0] >> a[1] >> a[2];

		rep(i,0,3){
			rep(j,0,3){

				if(i != j) new_dp[i] = max(new_dp[i], dp[j] + a[i]);
			}
		}

		dp = new_dp;
	}

	ret(*max_element(all(dp)));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAXN	2005
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
char mp[MAXN][MAXN];
int same[MAXN], diff[MAXN];
int n, m, input[MAXN];
int f[MAXN], size[MAXN];
int F(int x) {
	if (f[x] == x) return x;
	else return f[x] = F(f[x]);
}
int merge(int x, int y) {
	int tx = F(x);
	int ty = F(y);
	f[tx] = ty;
	size[ty] += size[tx];
	return size[ty];
}
int calc(int pos) {
	static vector <int> a[MAXN];
	for (int i = 1; i <= m; i++)
		f[i] = i, size[i] = 1;
	for (int i = 2; i <= m; i++)
		a[input[i]].push_back(i);
	int ans = 0;
	for (int i = 0; i < pos; i++) {
		for (unsigned j = 0; j < a[i].size(); j++)
			ans = max(ans, (pos - i) * merge(a[i][j] - 1, a[i][j]));
		a[i].clear();
	}
	return ans;
}
int main() {
	read(n), read(m);
	if (n == 1 || m == 1) {
		printf("%d\n", n * m);
		return 0;
	}
	for (int i = 1; i <= n; i++)
		scanf("\n%s", mp[i] + 1);
	int ans = max(n, m);
	for (int i = 1; i <= n; i++) {
		for (int j = 2; j <= m; j++)
			if (mp[i][j - 1] == mp[i][j]) input[j] = diff[j];
			else input[j] = same[j];
		ans = max(ans, calc(i));
		for (int j = 2; j <= m; j++)
			if (mp[i][j - 1] == mp[i][j]) same[j] = i;
			else diff[j] = i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 20096
#include<bits/stdc++.h>
#include <atcoder/segtree>
using namespace std;
#define fastIO std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define Local
#ifdef Local
    #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
    void err() { std::cout << std::endl; }
    template<typename T, typename...Args>
    void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
    template <template<typename...> class T, typename t, typename... A> 
    void err(const T <t> &arg, const A&... args) {
    for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
    #define dbg(...)
#endif
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
const ll mod=1000000007;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int N = 3e5 + 10;

using namespace atcoder;

int op(int a, int b) { return max(a, b); }

int e() { return 0; }

int n, k;
int a[N],dp[N];

int main()
{
    fastIO;
    cin >> n >> k;
    segtree<int, op, e> seg(N);

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        dp[i] = seg.prod(max(0,a[i] - k), min(N - 1, a[i] + k + 1)) + 1;
        seg.set(a[i], dp[i]);
      	//cout << dp[i] << endl;
        ans = max(ans, dp[i]);
    }
    cout << ans << endl;
    return 0;
}

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

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(Math.Pow(int.Parse(Console.ReadLine()),2)-int.Parse(Console.ReadLine()));
        }
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // long[] NK = Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // long N = NK[0];
            // long K = NK[1];
            // long K = long.Parse(Console.ReadLine());
            // int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int x = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int N = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string c = Console.ReadLine();
            // string B = Console.ReadLine();
            // string[] s = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
        
        // //最小公倍数
        // static long Lcm(long a, long b)
        // {
        //     return a/Gcd(a,b)*b;
        // }

        // //最大公約数
        // static long Gcd(long m, long n)
        // {
        //     if(n==0)return m;
        //     return Gcd(n,m%n);
        // }
    }
}


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

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

int N;
double x[11];
string u[11];
signed main() {
    cin >> N;
    double ans = 0;
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> u[i];
        if (u[i] == "JPY") { ans += x[i]; }
        else { ans += x[i] * 380000; }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VI pos(n);
  REP(i,0,n) {
    int a;
    cin >> a;
    pos[a-1] = i;
  }
  set<int> idx = {-1, n};
  ll ans = 0;
  REP(i,0,n) {
    int p = pos[i];
    auto it = idx.lower_bound(p);
    ll r = *it;
    ll l = *--it;
    ans += (i + 1) * (r - p) * (p - l);
    idx.insert(p);
  }
  cout << ans << endl;

  return 0;
}


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

const int maxn=200003;
typedef long long ll;

int a[maxn],pos[maxn],nxt[maxn],val[maxn],fi[maxn];
int n;ll k;

int main(){
	scanf("%d%lld",&n,&k);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
	if(n==1){
		if(k&1)printf("%d\n",a[1]);
		return 0;
	}
	for(int i=n;i>=1;--i)
		fi[a[i]]=i;
	for(int i=1;i<=n;++i){
		if(pos[a[i]])
			nxt[pos[a[i]]]=i%n+1;
		pos[a[i]]=i;
	}
	for(int i=1;i<=n;++i){
		if(!nxt[i]){
			if(fi[a[i]]==i)
				nxt[i]=i%n+1;
			else nxt[i]=fi[a[i]]+1;
		}
	}
	for(int i=1;i<=n;++i){
		if(nxt[i]>i+1)val[i]=nxt[i]-i;
		else val[i]=nxt[i]+n-i;
	}
	if(nxt[n]==1)val[n]=n+1;
	ll len=0;
	int cur=1;
	while(true){
		len+=val[cur];
		cur=nxt[cur];
		if(cur==1)break;
	}
	ll cir=len/n;
	k%=cir;
	if(!k)return 0;
	int id=1;cur=1;
	while(true){
		if(nxt[cur]>=cur+2){
			cur=nxt[cur];continue;
		}
		if(id==k){
			if(nxt[cur]==1&&cur!=n)return 0;
			printf("%d ",a[cur]);
			if(cur==n)return 0;
			++cur;
		}else{
			++id;
			cur=nxt[cur];
		}
	}
	return 0;
}



Measured memory_bytes: 5376
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

int main(){
    double a,b,x;
    cin >> a>>b>>x;
    double v=a*a*b;
    if(x>a*a*b/2){
        double y=2*(v-x)/(a*a);
        cerr<<y<<endl;
        double ans=atan(y/a)*180/(M_PI);
        printf("%.10f\n",ans);
    }else{
        double y=2*x/(a*b);
        cerr<<b/y<<endl;
        cerr<<atan(b/y)<<endl;
        double ans=atan(b/y)*180/(M_PI);
        printf("%.10f\n",ans);
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Mid (l+r)/2
#define int ll
const int mod=1e9+7,inf=0x3f3f3f3f,maxn=3e5+5;
int n,m,Q,K;

int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+c-'0';c=getchar();}
    return x*f;
}
int a[maxn],ton[70];
int ans=0;
int mmax(int x,int y){
    if(x>=y)return x;
    return y;
}
signed main(){
//  freopen("a.in","r",stdin);
//  freopen("a.out","w",stdout);
    n=read();
    int maxs=0;
    for(int i=1;i<=n;i++){
        a[i]=read();maxs=max(maxs,a[i]);
        //for(int j=0;(1<<j)<=a[i];++j)cout<<((a[i]>>j)&1);cout<<endl;
    }/*
    for(int i=n;i>=1;--i){
        for(int j=0;(1ll<<j)<=maxs;++j){
            //cout<<j<<" "<<ton[j]<<" "<<((a[i]>>j)&1)<<endl;
            if(((a[i]>>j)&1)==0)ans=(ans+(1ll<<j)*ton[j])%mod;
            else ans=(ans+(1ll<<j)*mmax(0,(n-i-ton[j])))%mod;
            //cout<<ans<<endl;
        }//cout<<endl;
        for(int j=0;(1ll<<j)<=maxs;++j){
            ton[j]+=((a[i]>>j)&1);
        }
    }*/
    for(int i=0;i<=61;++i){
        ton[0]=ton[1]=0;
        for(int j=n;j>=1;j--){
            ton[(a[j]>>i)&1]++;
            ans=(ans+(1ll<<i)%mod*ton[((a[j]>>i)&1)^1])%mod;
        }
    }
    /*
    rep(i, 0, 61) {
		ton[0] = ton[1] = 0;
		int sum = 0;
		drep(j, 1, n) ton[(a[j] >> i) & 1] ++, Ans = inc(Ans, mul((1ll << i) % mod, ton[((a[j] >> i) & 1) ^ 1]));
	}
    */
    printf("%lld\n",ans);



    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;
class Main {
	public static void main(String args[]){
    Scanner scan = new Scanner(System.in);

    int a = scan.nextInt();
    int b = scan.nextInt();

    int max = a + b;

    if(max<a-b) {
    	max=a-b;
    }

    if(max<a*b) {
    	max=a*b;
    }
    System.out.println(max);
	}
}

Measured memory_bytes: 27044
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }

int main() {
  int n, k; cin>>n>>k;
  double ans = 0;

  REP(i, 1, n+1) {
    double t = (double)1 / n;
    for (int j = i; j < k; j *= 2) t /= 2;
    ans += t;
  }
  cout << fixed << setprecision(10) << ans << endl;

  return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
ns = list(map(int, input().split()))
l = [1]
seen = set()
cur = 1
flag = True
while flag:
    i = ns[cur-1]
    cur = i
    if i in seen:
        ri = l.index(i)
        roop = l[ri:]
        flag = False
    else:
        l.append(i)
        seen.add(i)
if k <= len(l)-1:
    print(l[k])
else:
    print(roop[(k-len(l))%len(roop)])



Measured memory_bytes: 124944
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <set>
using namespace std;
int main(){
  int a = 0;
  cin >> a;
  set<int> b;
  int memo = 0;
  for(int i = 0;i <= a - 1;i++){
    cin >> memo;;
    b.insert(memo);
  }
  if(a == b.size()){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.out



int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    ll a,b;
    cin>>a>>b;
    if((a+b)%2==1)fin("IMPOSSIBLE");
    else cout<<(a+b)/2<<endl;    

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
x1, y1, x2, y2  = map(int, input().split())

dx = x2 - x1
dy = y2 - y1

x3, y3 = x2 - dy, y2 + dx
x4, y4 = x1 - dy, y1 + dx
print(x3,y3,x4,y4)

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

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

  int k, a, b;
  cin >> k >> a >> b;

  int x = (a - 1) / k;
  int y = b / k;

  cout << (y - x > 0 ? "OK" : "NG") << '\n';

  return (0);
}


Measured memory_bytes: 3608
n = int(input())
while n != 0:
    score = {}
    j = 0
    for i in range(n):
        e,p,q = list(map(int,input().split()))
        if e in score:
            score[e]["value"] += p*q
        else:
            score[e] = {"value":p*q, "index":j}
            j += 1
    f = {}
    for e,v in score.items():
        if v["value"] >= 1000000:
            f[v["index"]] = e
    if len(f)==0:
        print("NA")
    else:
        for w in sorted(f.items(), key = lambda x:x[0]):
            print(w[1])
    n = int(input())

Measured memory_bytes: 8232
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1e9+7;

int main() {
  int n,m;
  cin>>n>>m;
  vector<pair<long long,int>> ab(n);
  rep(i,n) cin>>ab[i].first>>ab[i].second;
  sort(ab.begin(),ab.end());
  long long cost=0;
  rep(i,n){
    //cout<<ab[i].first<<" "<<ab[i].second<<endl;
    long long buy=min(m,ab[i].second);
    //cout<<buy<<endl;
    m-=buy;
    cost+=buy*ab[i].first;
    if(m==0) break;
  }
  cout<<cost<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
template<typename T> void show(T e){ cout << e << endl; }
template<typename T> void show(const vector<T>& v){ for(const auto& e : v){ cout << e << " "; } cout << endl; }
template<typename T> void show(const vector<vector<T>>& vv){ for(const auto& v : vv){ show(v); } }
template<class Iter> void show(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
const ll DVSR = 10e9+7;


int main(int argc, char const *argv[])
{
  ll N, K; cin >> N >> K;
  ll halfK = K / 2, cnt1 = 0, cnt2 = 0;

  if (K%2 == 0) {
    RNG(i,1,N+1) {
      cnt1 += (i%K == 0);
      cnt2 += (i%K == halfK);
    }
  } else {
    RNG(i,1,N+1) if (i%K == 0) cnt1++;
  }
  cout << cnt1*cnt1*cnt1 + cnt2*cnt2*cnt2 << endl;
  return 0;
}


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

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define F first
#define S second
#define INF ll(1e18)
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 300005

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	ll n,k; cin>>n>>k;
	if(2*k-1>n){
		cout<<-1<<'\n';
		return 0;
	}
	
	ll cur=k+2*n;
	ll i=k;
	ll j=cur-i;
	
	bool used[MAXN]; mset(used,0);
	
	while(j>i){		
		cout<<i<<" "<<j<<" "<<cur<<'\n';
		
		used[i-k]=used[j-k]=1;
		cur++;
		i+=2;
		j--;
	}
	
	i=k+1;
	j=k+2*n-1;
	while(cur<k+3*n){
		while(used[j-k]) j--;
		
		used[i-k]=used[j-k]=1;
		cout<<i<<" "<<j<<" "<<cur<<'\n';
		
		cur++;
		i+=2;
	}
	
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int main(){
    string s;
    cin >> s;
    while(s != "ABC"){
        if(s.size() <= 2){
            puts("No");
            return 0;
        }
        int cnt[3] = {0, 0, 0};
        for(int i=0; i<(int)s.size(); ++i){
            if(s.substr(i, 3) == "ABC") i += 2;
            else cnt[s[i]-'A'] = 1;
        }
        if(accumulate(cnt, cnt+3, 0) != 2){
            puts("No");
            return 0;
        }
        char c;
        rep(i, 3)if(!cnt[i]) c = 'A' + i;
        string t;
        for(int i=0; i<(int)s.size(); ++i){
            if(s.substr(i, 3) == "ABC"){
                t += c;
                i += 2;
            }
            else t += s[i];
        }
        swap(s, t);
    }
    puts("Yes");
}


Measured memory_bytes: 3224
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		TreeMap<String, Integer> map = new TreeMap<>();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
		    int type = sc.nextInt();
		    String key = sc.next();
		    if (type == 0) {
		        int value = sc.nextInt();
		        map.put(key, value);
		    } else if (type == 1) {
		        if (map.containsKey(key)) {
		            sb.append(map.get(key));
		        } else {
		            sb.append(0);
		        }
		        sb.append("\n");
		    } else if(type == 2) {
		        map.remove(key);
		    } else {
		        String end = sc.next();
		        key = map.lowerKey(key);
		        if (key == null) {
		            key = "";
		        }
		        while ((key = map.higherKey(key)) != null && key.compareTo(end) <= 0) {
		            sb.append(key).append(" ").append(map.get(key)).append("\n");
		        }
		    }
		}
		System.out.print(sb);
	}
}



Measured memory_bytes: 198380
/*input

*/
/**
 * D - Knapsack 1
 * @author: Raj
 */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#define endl '\n'
#define lli long long int
#define vi vector<int>
#define vlli vector<lli>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define MOD 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb(n) emplace_back(n)
#define pb(n) push_back(n)
#define F first
#define S second
#define int long long int
#define double long double
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
void note_to_myself(){
	//new_data_set s;
	//logn operations
	//cout << *(s.find_by_order(i)) << " ";
	//cout << "The index of number 6::" << p.order_of_key(6) << endl; 
}
int add(int x, int y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
int sub(int x, int y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
int mul(int x, int y) {
	return ((long long)x * y) % MOD;
}
inline int power(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
inline int inv(int a) {
	a %= MOD;
	if (a < 0) a += MOD;
	int b = MOD, u = 0, v = 1;
	while (a) {
		int t = b / a;
		b -= t * a; swap(a, b);
		u -= t * v; swap(u, v);
	}
	assert(b == 1);
	if (u < 0) u += MOD;
	return u;
}
void maxs(int& a, int b){
	a = max(a,b);
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,W;
	cin >> n >> W;
	vi dp(W+1);
	for (int item = 0; item < n; ++item){
		int weight,value;			
		cin >> weight >> value;
		for(int w_already = W-weight; w_already >= 0 ; --w_already){
			maxs(dp[w_already+weight],dp[w_already]+value);
		}
	}
	int ans = 0;
	for (int i = 0; i < W+1; ++i){
		maxs(ans,dp[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<stack>
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
using namespace std;
typedef long long LL;
const int N=200010;
template<typename T>inline T chkmax(T A,T B){return A>B?A:B;}
template<typename T>inline T chkmin(T A,T B){return A<B?A:B;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
int n,cnt,R,C;
stack<int>st;
struct node
{
	int x,id,flag;
	node(){}
	node(int A,int B,int C):x(A),id(B),flag(C){}
}a[N];
inline bool operator<(node A,node B){return A.x<B.x;}
inline bool OnBoundary(int x,int y){return x==0||x==R||y==0||y==C;}
inline int find(int x,int y)
{
	if(x==0)return y;
	if(x==R)return C+R+C-y;
	if(y==0)return R+R+C+C-x;
	if(y==C)return C+x;
}
int main()
{
	int x1,y1,x2,y2;
	read(R),read(C),read(n);
	For(i,1,n)
	{
		read(x1),read(y1),read(x2),read(y2);
		if(OnBoundary(x1,y1)&&OnBoundary(x2,y2))
		{
			int l=find(x1,y1),r=find(x2,y2);
			if(l>r)swap(l,r);
			a[++cnt]=node(l,i,0);
			a[++cnt]=node(r,i,1);
		}
	}
	sort(a+1,a+cnt+1);
	For(i,1,cnt)
	{
		if(a[i].flag)
		{
			if(st.top()!=a[i].id)
				return puts("NO"),0;
			else st.pop();
		}
		else st.push(a[i].id);
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 2816
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define LLINF (1<<30)
#define MOD 1000000007
using ll = long long;
using namespace std;

typedef pair<int, int> P;
vector<int> tree[100005];
int N, d[100005] = {}, one[100005] = {}, n[100005] = {};

void dfs(int s, int d[]) {
    cout << endl;
    for (int i = 0; i <= N; i++)d[i] = INF;
    queue<int> que;
    que.push(s);
    d[s] = 0;
    while (que.size()) {
        int t = que.front();
        que.pop();
        for (int i = 0; i < tree[t].size(); i++) {
            if (d[tree[t][i]] == INF) {
                que.push(tree[t][i]);
                d[tree[t][i]] = d[t] + 1;
            }
        }
    }
}

int main() {
    cin >> N;
    for (int i = 0; i < N-1; i++) {
        int a, b;
        cin >> a >> b;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    
    dfs(1, one);
    dfs(N, n);

    int Fennec = 0;
    for (int i = 1; i <= N; i++) {
        if (one[i] <= n[i])Fennec++;
    }
    if (Fennec > (N - Fennec))cout << "Fennec";
    else cout << "Snuke";
    return 0;
}


Measured memory_bytes: 6656
#include <stdio.h>

int main()
{
	char S[7];
	int n;
	int i;

	scanf("%s",S);

	n=0;

	for(i=0;i<6;i++){
		if(S[i]=='1'){
			n++;
		}
	}

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

	return 0;
}


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

int main()
{
    int n, input;
    cin >> n;
    int *nomor = new int[n+1];
    for(int i=1; i<=n; ++i)
    {
        cin >> input;
        nomor[input] = i;
    }
    for(int i=1; i<=n; ++i)
        cout << nomor[i] << ' ';
    return 0;
}


Measured memory_bytes: 1152
import java.util.Arrays;
import java.util.Scanner;

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

    public static void solve(Scanner sc) {
        int h = sc.nextInt();
        int w = sc.nextInt();
        char[][] map = new char[h + 2][w + 2];
        for (int i = 0; i < h; i++) {
            Arrays.fill(map[i], '.');
        }
        for (int i = 1; i <= h; i++) {
            char[] lineChars = sc.next().toCharArray();
            for (int j = 1; j <= w; j++) {
                map[i][j] = lineChars[j - 1];
            }
        }

        for (int i = 1; i <= h; i++) {
            for (int j = 1; j < w; j++) {
                if (map[i][j] == '#' && map[i + 1][j] == '.' && map[i - 1][j] == '.' && map[i][j + 1] == '.'
                        && map[i][j - 1] == '.') {
                    System.out.println("No");
                    return;
                }
            }
        }

        System.out.println("Yes");
    }
}

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

using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<vector<bool>> problems(N);
  for(int i = 0; i < M; i++){
    int p;
    string s;
    cin >> p >> s;
    p--;
    int t = problems[p].size();
    if((t > 0 && !problems[p][t - 1]) || t == 0){
      if(s == "AC") problems[p].push_back(true);
      else problems[p].push_back(false);
    }
  }
  
  int ac = 0;
  int pe = 0;
  for(int i = 0; i < N; i++){
    int t = problems[i].size();
    if(t > 0 && problems[i][t - 1]){
      ac++;
      pe += (int)problems[i].size() - 1;
    }
  }
  
  cout << ac << ' ' << pe << endl;
  
  return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[200];
ll n, k;
ll f(int x);
int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll l = -1000000, r = 1000000, m1, m2, ans = 0;
    while (l < r) {
        m1 = l + (r - l) / 3;
        m2 = r - (r - l) / 3;
        ll sum1 = 0, sum2 = 0;
        sum1 = f(m1);
        sum2 = f(m2);
        if (sum1 < sum2) {
            r = m2 - 1;
            ans = r;
        } else {
            l = m1 + 1;
            ans = l;
        }
    }
    ll mmin = 1000000000000;
    for (int i = -2; i <= 2; i++) {
        mmin = min(mmin, f(ans + i));
    }
    cout << mmin;
}
ll f(int x) {
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        sum += llabs(a[i] - x) * llabs(a[i] - x);
    }
    return sum;
}

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

int main(){
    int N, K, X, Y, S;
    cin>>N>>K>>X>>Y;
    if(N>K){
        S=K*X+(N-K)*Y;
    }else{
        S=N*X;
    }
    cout<<S<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;

Node treeSearch(Node u, int k){
  while(u != NIL && k != u->key){
    if(k < u->key){
      u = u->left;
    }
    else{
      u = u->right;
    }
  }
  return u;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }
    else{
      x = x->right;
    }
  }
  z->parent = y;
  if(y == NIL){
    root = z;
  }
  else if(z->key < y->key){
    y->left = z;
  }
  else{
    y->right = z;
  }
}

void inorder(Node u){
  if(u->left != NIL){
    inorder(u->left);
    printf(" %d", u->key);
    if(u->right != NIL){
      inorder(u->right);
    }
  }
  else{
    if(u->right != NIL){
      printf(" %d", u->key);
      inorder(u->right);
    }
    else{
      printf(" %d", u->key);
    }
  }
}


void preorder(Node u){
  printf(" %d", u->key);
  if(u->left != NIL){
    preorder(u->left);
    if(u->right != NIL){
      preorder(u->right);
    }
  }
  else{
    if(u->right != NIL){
      preorder(u->right);
    }
  }  
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for(i = 0;i < n;i++){
    scanf("%s", com);

    if ( com[0] == 'f' ){
      scanf("%d", &x);
      if (treeSearch(root, x) != NIL) {
	printf("yes\n");
      }
      else{ 
	printf("no\n");
      }
    }

    else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } 

    else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }

  }
  return 0;
}

Measured memory_bytes: 19364
#include<stdio.h>
#define N 100
int main(){
  int M[N][N];
  int a,b,c,n,i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++)M[i][j]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&a,&b);
    a--;
    for(j=0;j<b;j++){
      scanf("%d",&c);
      c--;
      M[a][c]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j)printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2108
import sys
# gcd
# from fractions import gcd
# 切り上げ，切り捨て
# from math import ceil, floor
# リストの真のコピー（変更が伝播しない）
# from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
# from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l)  # カウンタークラスが作られる。S=Counter({'b': 5, 'c': 4, 'a': 3})
# print(S.most_common(2))  # [('b', 5), ('c', 4)]
# print(S.keys())  # dict_keys(['a', 'b', 'c'])
# print(S.values())  # dict_values([3, 5, 4])
# print(S.items())  # dict_items([('a', 3), ('b', 5), ('c', 4)])
# from collections import Counter
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template


A, B, C = mi()
if A < C < B or B < C < A:
    print('Yes')
else:
    print('No')


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	long long int n,k;
	cin>>n>>k;
	vector<long long int> v;
	while(n--){
		long long int x;
		cin>>x;
		v.push_back(x);
	}
	for(long long int i=1;i<v.size()-k+1;i++){
		if(v[i-1]<v[i+k-1]){
			cout<<"Yes\n";
		}
		else{
			cout<<"No\n";
		}
	}
	return 0;
}

Measured memory_bytes: 5328
#include <stdio.h>
int main(void){
int A,B;
scanf("%d %d",&A,&B);
if(A>B) printf("%d\n",2*A-1);
if(A<B) printf("%d\n",2*B-1);
if(A==B) printf("%d\n",2*B);
return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 60;
int a[MAXN],pos[MAXN];
int main(){
	int n; cin>>n;
	for(int i=1; i<=n; i++){
		int aux; cin>>aux;
		pos[aux] = i;
	}
	int ans = 0;
	for(int i=1; i<=n; i++){
		int aux; cin>>aux;
		ans+=aux;
	}
	for(int i=1; i<n; i++){
		int aux; cin>>aux;
		if(pos[i+1] == pos[i]+1)ans+=aux;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
inline int readint()
{
	char c;int tmp=0,x=1;c=getchar();
	while(!isdigit(c)){if(c=='-') x=-1;c=getchar();}
	while(isdigit(c)){tmp=tmp*10+c-'0';c=getchar();}
	return tmp*x;
}
const int maxn=200000+5;
int a[maxn],x[maxn],y[maxn],cnt[maxn],b[maxn];
int n,m;
int main()
{
	n=readint(),m=readint();
	int emp=n;
	for(int i=1;i<=n;i++){
		a[i]=readint();
		cnt[a[i]]++;
		int pos=a[i]-cnt[a[i]]+1;
		if(pos>=1 && (b[pos]++) ==0) emp--;
	}
	for(int i=1;i<=m;i++){
		x[i]=readint(),y[i]=readint();
		int pos=a[x[i]]-cnt[a[x[i]]]+1;cnt[a[x[i]]]--;
		if(pos>=1 && (--b[pos])==0) emp++;
		cnt[a[x[i]]=y[i]]++;pos=y[i]-cnt[y[i]]+1;
		if(pos>=1 && (b[pos]++)==0) emp--;
		printf("%d\n",emp);
	}
	return 0;
}


Measured memory_bytes: 5376
using Primes

function calc(Num)
    res = factor(Num) # key
    k = 0
    for i in keys(res)
        j = 1
        while j <= res[i]
            #println("NUM4: $Num")
            if Num % i^j == 0
                Num = Num / i^j
                k += 1
            else
                break
            end
            j += 1
        end
    end
    k
end
T = readline() #println("Input: ",split(tmp))
Num = parse(Int128, T)
#println("NUM: $Num")
if isprime(Num) == true
    println(1)
else
    k = calc(Num)
    println(k)
end

Measured memory_bytes: 222296
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>
#include <cstdarg>

using namespace std;

typedef long long ll;

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

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;


// Extended Print Func
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& input){
    os << "[ ";
    REP(i, input.size()){
        os << input[i];
        if (i < input.size()-1) { os << " "; }
    }
    os << " ]";
    return os;
}
void print() { cout << "\n"; }
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
template<class... A> void print(const A&... rest) { print(rest...); }



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll A, B;
  cin >> A >> B;

  ll cnt = 0;
  ll c = 1;
  while (c < B){
    c += A - 1;
    cnt ++;
  }
  cout << cnt << "\n";  
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        long N = long.Parse(str[0]);
        long M = long.Parse(str[1]);
        long count;
        if(2*N >= M){
            count = M/2;
        }
        else{
            count = (2*N+M)/4;
        }
        sb.Append(count+"\n");
    }
}

Measured memory_bytes: 13140
import math
from functools import reduce

n = int(input())
def gcd(*numbers):
  return reduce(math.gcd, numbers)

sum1 = 0
sum3 = 0
sum6 = 0
for i in range(1, n+1):
  for j in range(1, i+1):
    for k in range(1, j+1):
      if i!=j and j!=k and k!=i:
        sum6 += gcd(i,j,k)
      elif i==j and j==k:
        sum1 += i
      else:
        sum3 += gcd(i,j,k)

sum = sum1 + sum3*3 + sum6*6

print(sum)

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

#ifdef LOCAL
#include "/home/shahraaz/bin/debug.h"
#else
#define db(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()

const int NAX = 2e5 + 5, MOD = 1000000007;

class Solution
{
private:
public:
    Solution() {}
    ~Solution() {}
    void solveCase()
    {
        int n;
        cin >> n;
        ll ret = 0;
        for (size_t i = 1; i <= n; i++)
        {
            ll lim = n / i;
            ret += i * (lim) * (lim + 1) / 2;
        }
        cout << ret << '\n';
    }
};

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
    // cin >> t;
    Solution mySolver;
    for (int i = 1; i <= t; ++i)
    {
        mySolver.solveCase();
#ifdef LOCAL
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#define LL long long
using namespace std;
int main()
{
    int a,b,c;
    while(~scanf("%d%d%d",&a,&b,&c))
    {
        if (a==b && a==c)
        {
            printf("Yes\n");
        }
        else
        {
            printf("No\n");
        }

    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--) 
#define Rep(i,a) for(int i = 0; i < a; i++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ab(x) ((x) < 0 ? -(x) : (x))
using namespace std;
typedef long long LL;
typedef map<int, int>::iterator mit;
typedef set<LL>::iterator sit;
const int N = 1e5 + 10;
const LL inf = 1e13;
int l[N], r[N];
multiset<LL> s0, s1; LL d0, d1;
int main() {
	int n; scanf("%d",&n);
	int l1 = 0;
	rep(i,1,n) {
		scanf("%d%d",&l[i],&r[i]);
		int l2 = r[i] - l[i]; 
		if (i > 1) d0 -= l2, d1 += l1;
		l1 = l2;
		LL L, R;
		if (i > 1) {
			sit it = s0.end(); it--;
			L = *it + d0;
			it = s1.begin();
			R = *it + d1;
		} else L = 0, R = 0;
		if (L <= l[i] && l[i] <= R) {
			s0.insert(l[i] - d0), s1.insert(l[i] - d1);
		} else if (l[i] < L) {
			s0.insert(l[i] - d0), s0.insert(l[i] - d0);
			sit it = s0.end(); it--;
			s1.insert(*it + d0 - d1); s0.erase(it);
		} else if (l[i] > R) {
			s1.insert(l[i] - d1), s1.insert(l[i] - d1);
			sit it = s1.begin(); 
			s0.insert(*it + d1 - d0); s1.erase(it);
		}
	}
	LL cur = 0, t = -inf;
	dep(i,n,1) cur += l[i] - t, t += r[i] - l[i];
	int d = -n; LL tmp = -inf;
	for(sit it = s0.begin(); it != s0.end(); it++)
		cur += 1LL * d * (*it + d0 - tmp), tmp = *it + d0, d++;
	cout <<cur<<endl;
	return 0;
}


Measured memory_bytes: 10368