akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define MAX 10000007
#define PI acos(-1)
#define eps 1e-8
#define eq(x,y) (fabs((x)-(y)) < eps)
#define debug(x) cout<<x<<endl;
#define endl "\n"
#define MEM(a,x) memset(a,x,sizeof(a))

using namespace std;
typedef long long ll ;
const int INF= 1e9+7;

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<long long,null_type,less<long long>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
*/
/*
bool sortbysec(const pair<int,int>&a, const pair<int,int>&b)
{
    return (a.second<b.second);
}
*/
int even[MAX],odd[MAX];
int cnt;
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.tie(NULL);
    int n;
    cin>>n;
    vector<int>v(n+5);

    for(int i=1; i<=n; i++)
    {
        cin>>v[i];

        if(i%2)
            odd[v[i]]++;
        else
            even[v[i]]++;
    }

    int maxo=-INF, maxe=-INF;
    int o1,o2=0,e1,e2=0;

    for(int i=1; i<=100000; i++)
    {
        if(odd[i]>maxo)
        {
            maxo=odd[i];
            o1=i;
        }

        if(even[i]>maxe)
        {
            maxe=even[i];
            e1=i;
        }
    }

    if(o1!=e1)
    {
        for(int i=1; i<=n; i++)
        {
            if(i%2)
            {
                if(v[i]!=o1)
                    cnt++;
            }
            else
            {
                if(v[i]!=e1)
                    cnt++;
            }
        }

        cout<<cnt<<endl;
    }
    else
    {
        odd[o1]=-INF;
        even[e1]=-INF;
        maxo=-INF;
        maxe=-INF;

        for(int i=1; i<=100000; i++)
        {
            if(odd[i]>maxo && odd[i]!=0)
            {
                maxo=odd[i];
                o2=i;
            }

            if(even[i]>maxe && even[i]!=0)
            {
                maxe=even[i];
                e2=i;
            }
        }

        //cout<<o1<<" "<<e1<<endl;
        //cout<<o2<<" "<<e2<<endl;


        int cn1=0,cn2=0;

        for(int i=1; i<=n; i++)
        {
            if(i%2)
            {
                if(v[i]!=o1)
                    cn1++;
            }
            else
            {
                if(v[i]!=e2)
                    cn1++;
            }

            if(i%2)
            {
                if(v[i]!=o2)
                    cn2++;
            }
            else
            {
                if(v[i]!=e1)
                    cn2++;
            }

        }

        cout<<min(cn1,cn2)<<endl;

    }



    return 0;
}


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

using namespace std;

#define MAX 24

int N,x[MAX],y[MAX],r[MAX],c[MAX];

int dist(int a,int b){
    return (x[a]-x[b])*(x[a]-x[b]) + (y[a]-y[b])*(y[a]-y[b]);
}

bool check(int a,int b){
    int d = dist(a,b);
    int add = r[a]+r[b],sub = r[a]-r[b];
    return ((sub*sub < d && d < add*add) || d <= sub*sub);
}

int main(){
    while(cin >> N, N){
        for(int i = 0 ; i < N ; i++){
            cin >> x[i] >> y[i] >> r[i] >> c[i];
        }
        int bit[MAX] = {0};
        for(int i = 0 ; i < N ; i++){
            for(int j = 0 ; j < i ; j++){
                if(check(i,j)) bit[i] |= (1<<j);
            }
        }
        vector<bool> dp(1<<N,0);
        dp[(1<<N)-1] = 1;
        int res = 0;
        for(int i = (1<<N)-1 ; i >= 0 ; i--){
            if(dp[i] == 0) continue;
            if(N%2 == 0 && __builtin_popcount(i) % 2 == 1) continue;
            if(N%2 == 1 && __builtin_popcount(i) % 2 == 0) continue;
            int n = __builtin_popcount(i);
            for(int j = 0 ; j < N ; j++){
                if((i&bit[j]) > 0) continue;
                for(int k = j+1 ; k < N ; k++){
                    if(c[j] != c[k]) continue;
                    if((i&bit[k]) > 0) continue;
                    int S = i & ~((1<<j) | (1<<k));
                    dp[S] = 1;
                    res = max(res,N-n);
                }
            }
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 3252
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var l,r int64
    fmt.Scan(&l,&r)
    var ans int64 = 10000
    var mod int64 = 2019
    for i:=int64(l);i<=min64(l+2020,r);i++{
        for j:=i+1;j<=min64(l+2020,r);j++{
            ans = min64(ans,i*j%mod)
        }
    }
    fmt.Println(ans)
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



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

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

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

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

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func makeTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func sortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}

func reverseString(s string) string{
    t := []rune(s)
    for i,j := 0, len(s)-1 ; i < j ; i, j = i+1, j-1 {
        t[i], t[j] = t[j], t[i]
    }
    return string(t)
}

func stringRev(s []byte,l int,r int) []byte{
    for i:=0;i<(r-l+1)/2;i++{
        s[l-1+i], s[r-1-i] = s[r-1-i], s[l-1+i]
    }
    return s
}

func inside(h,w,H,W int) bool{
    if h>=0 && h<H && w>=0 && w<W{
        return true
    }
    return false
}



Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include <string>
#include<cstdio>
#include<stack>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}

using namespace std;
typedef long long ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}

//------------------変数-----------------------//
ll n, cou[40][50], kekka[40], m;
string a[60];
//-------------------関数----------------------//
int main() {
	cin >> n >> m;
	if (n <= m / 2) {
		cout << (n * 2 + m) / 4 << endl;
	}
	else {
		cout << m / 2 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a =  sc.nextLong();
    long b =  sc.nextLong();
    long n =  sc.nextLong();
    long x = n;
    if(n>=b-1)x = b-1;
    System.out.println((a*(x%b)-(a*x)%b)/b);
  }
}

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

 int main()
     {
  int n,res;
  cin>>n;
  if(n<15)
    {cout<<n*800;
  return 0;}

  res=(800*n)-(200*(n/15));
  cout<<res;
   return 0;
     }


Measured memory_bytes: 3616
import java.util.Scanner;
import java.lang.Math;
class Main 
{
  public static void main(String[] args) 
  {
    Scanner input=new Scanner(System.in);
    int n=input.nextInt();
    int a=input.nextInt();
    int b=input.nextInt();
    int counter=0;
    for(int i=1;i<=n;i++)
    {
      String c=""+i;
      int count=0;
      for(int k=0;k<c.length();k++)
      {
        char d=c.charAt(k);
        count=count+Integer.parseInt(""+d);
      }
      if(count>=a && count<=b)
      {
        counter=counter+i;
      }
    }
    System.out.println(counter);
  }
}

Measured memory_bytes: 30996
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import os
import sys
import datetime
from functools import lru_cache
readline=readline = sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s


#@lru_cache(maxsize=None)  
def f():
    return 1
#main
s=input()
ans=True
n=len(s)
if(not s==s[::-1]):ans=False
if(not s[:n//2]==s[:n//2][::-1]):ans=False
if(not s[(n+3)//2-1:]==s[(n+3)//2-1:][::-1]):ans=False

Yn(ans)

Measured memory_bytes: 69612
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define MOD 1000000007
#define INF (1<<30)

int main(void){
	int a,b,i,n;
	string s;
	bool flag = true;
	cin >> a >> b;
	cin >> s;
	n = s.length();
	if(n != (a+b+1)){
		flag = false;
		cout << "No" << endl;
		return 0;
	}
	for(i=0; i<a; i++){
		if(s[i]<'0' || s[i]>'9'){
			flag = false;
			cout << "No" << endl;
			return 0;
		}
	}
	if(s[a] != '-'){
		flag = false;
		cout << "No" << endl;
		return 0;
	}
	for(i = (a+1); i<n; i++){
		if(s[i]<'0' || s[i]>'9'){
			flag = false;
			cout << "No" << endl;
			return 0;
		}
	}
	if(flag){
		cout << "Yes" << endl;
	}
	return 0;
}


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

int main() {
  string S;
  cin >> S;
  int N = S.size();
  for (int i = 0; i + 1 < N; i++) {
    if (S.at(i) == S.at(i + 1)) return cout << i + 1 << " " << i + 1 + 1 << "\n", 0;
  }
  for (int i = 0; i + 2 < N; i++) {
    if (S.at(i) == S.at(i + 2)) {
      if (S.at(i) != S.at(i + 1)) return cout << i + 1 << " " << i + 2 + 1 << "\n", 0;
    }
  }
  cout << -1 << " " << -1 << "\n";
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	int n,a;
	cin>>n>>a;
	cout<<(a<n%500?"No":"Yes")<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#define  endl '\n'
#define all(s) s.begin(),s.end()
#define lowbit(x) (x&-x)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define pb push_back
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const int mod=1e9+7;
const double eps=1e-8;
const int inf=0x3f3f3f3f;
const int N=610;
int head[N];
ll c[N],d[N],dst[1000][3000];
struct node{
    int to;
	ll s,t;
	bool operator<(const node&f)const{
    	return t>f.t;
	}
};
struct Edge{
	int to,next;
	ll t,s;
}e[N];
int cnt=0;
void add(int u,int v,int s,int t)
{
	e[++cnt].to=v;
	e[cnt].t=t;
	e[cnt].s=s;
	e[cnt].next=head[u];
	head[u]=cnt;
}
int main()
{
	int n,m,u,v,s,ss,t;
	cin>>n>>m>>s;
	for(int i=1;i<=m;i++){
		cin>>u>>v>>ss>>t;
		add(u,v,ss,t);
		add(v,u,ss,t);
	}
	for(int i=1;i<=n;i++){
		cin>>c[i]>>d[i];
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<=2500;j++)
		dst[i][j]=2e18;
	}
	if(s>2500) s=2500;
	priority_queue<node>q;
	q.push(node{1,s,0});
	dst[1][s]=0;
	while(!q.empty()){
	//	cout<<"?";
		node on=q.top();
		q.pop();
		if(on.t>dst[on.to][on.s]) continue;
		for(int i=head[on.to];i;i=e[i].next){
			if(on.s>=e[i].s){
				int v=e[i].to;
				if(dst[v][on.s-e[i].s]>dst[on.to][on.s]+e[i].t){
					dst[v][on.s-e[i].s]=dst[on.to][on.s]+e[i].t;
					q.push(node{v,on.s-e[i].s,dst[on.to][on.s]+e[i].t});
				}
			}
		}
		ll mx=min((ll)2500,on.s+c[on.to]);
		if(dst[on.to][mx]>dst[on.to][on.s]+d[on.to]){
			dst[on.to][mx]=dst[on.to][on.s]+d[on.to];
			q.push(node{on.to,mx,dst[on.to][mx]});
		}
	}
	for(int i=2;i<=n;i++){
		ll mx=2e18;
		for(int j=0;j<=2500;j++){
			mx=min(mx,dst[i][j]);
		}
		cout<<mx<<endl;
	}
}


Measured memory_bytes: 7068
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
 
#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
 
//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif
 
 
//改造
typedef long long int ll;
using namespace std;
 
 
//ここから編集する
 
int main() {
    vector<int> v;
    int tmp;
    for(int i = 0; i < 3; i++){
        cin >> tmp;
        v.push_back(tmp);
 
    }
 
    sort(v.begin(),v.end());
    int go[] = {5,5,7};
    for(int i = 0; i < 3; i++){
        if(go[i] != v[i]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 256
s = input()
for i in range(8):
  e = bin(i)[2:]
  e = '0' * (3-len(e)) + e
  su = int(s[0])
  for i in range(3):
    if e[i] == '0':
      su -= int(s[i+1])
    else:
      su += int(s[i+1])
  if su == 7:
    a = s[0]
    for i in range(3):
      if e[i] == '0':
        a += '-'
      else:
        a += '+'
      a += s[i+1]
    a += '=7'
    print(a)
    exit()

Measured memory_bytes: 3064
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=100005;
typedef long long ll;
int n,a[3][N];
int t[N+5];
int lowbit(int x){return x&-x;}
int z[3],p[N];
int flip[2],rev[2];
void Modify(int x,int d){
    while(x<=N){
        t[x]+=d;
        x+=lowbit(x);
    }
}
int Query(int x){
    int res=0;
    while(x){
        res+=t[x];
        x-=lowbit(x);
    }
    return res;
}
int main()
{
    scanf("%d",&n);
    for(int i=0;i<3;i++)
        for(int j=1;j<=n;j++)
            scanf("%d",&a[i][j]);
    for(int i=1;i<=n;i++){
        z[0]=a[0][i],z[1]=a[1][i],z[2]=a[2][i];
        sort(z,z+3);
        if(z[2]%3!=0||z[0]+1!=z[1]||z[1]+1!=z[2]||z[1]!=a[1][i]){
            puts("No\n");
            return 0;
        }
        int j=z[2]/3;
        if((i-j)%2!=0){
            puts("No\n");
            return 0;
        }
        rev[i%2]^=a[0][i]>a[2][i];
        p[j]=i;
    }
    for(int i=1;i<=n;i+=2){
        int now=p[i]+(i/2+Query(p[i]))*2;
        Modify(p[i],1);
        if((abs(i-now)/2)%2==1)
            flip[i%2]^=1;
    }
    memset(t,0,sizeof t);
    for(int i=2;i<=n;i+=2){
        int now=p[i]+(i/2-1+Query(p[i]))*2;
        Modify(p[i],1);
        if((abs(i-now)/2)%2==1)
            flip[i%2]^=1;
    }
    if(rev[0]==flip[1]&&rev[1]==flip[0])
        puts("Yes");//
    else
        puts("No");
}


Measured memory_bytes: 2176
#include <stdio.h>
int main(void)
{
	int a, b, c, n = 0;
	scanf("%d %d %d", &a, &b, &c);
	int i = a;
	while (i <= b)
	{
		if(c % i == 0)
		{
			n++;
		}
		i++; 
	}
	printf("%d\n", n);
	return 0;
} 


Measured memory_bytes: 2756
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String head = "";
    if(N<1000){
      head="ABC";
    }else{
      head="ABD";
      N=N-999;
    }
    if(N<10){
      System.out.print(head);
//      System.out.print("00");
//      System.out.print(N);
    }else if(N<100){
      System.out.print(head);
//      System.out.print("0");
//      System.out.print(N);
    }else{
      System.out.print(head);
//      System.out.print(N);
    }
    
    
      
  }
  

  
}

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

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define fs first
#define sc second
#define fr(i, a, b) for(int i = a ; i < b ; i++)
#define frr(i, a, b) for(int i = a ; i >= b ; i--)
#define tr(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define trr(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define its(x) static_cast< ostringstream & >( ( ostringstream() << dec << x ) ).str() // int to string
#define boost ios_base::sync_with_stdio(false)
#define deb(x) cout << #x" = " << x << '\n'
#define has(cont, x) ((cont).find((x)) != (cont).end())
#define sz(x) ((int)(x).size())

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

list<char> a, b;
char sa[1234], sb[1234];

bool same() {
	for(list<char>::iterator it1 = a.begin(), it2 = b.begin() ; it1 != a.end() ; it1++, it2++) {
		if(*it1 != *it2) 
			return false;
	}
	return true;
}

void rotate() {
	char x = a.back();
	a.pop_back();
	a.push_front(x);
//	printf("%c\n", x);
//	a.pop_back();
	
}

int main() {
//    freopen("input.in", "r", stdin);
	scanf("%s %s", sa, sb);
	int ssa = strlen(sa), ssb = strlen(sb);
	
	fr(i, 0, ssa) a.pb(sa[i]);
	fr(i, 0, ssb) b.pb(sb[i]);
	
	fr(i, 0, ssa) {
		rotate();
		if(same()) {
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}

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

struct Node{
  int right;
  int left;
  int parent;
  int key;
}typedef N;

main(){
  int i,n;
  N t[252];

  scanf("%d", &n);

  for(i = 1;i  <= n;i++){
    scanf("%d", &t[i].key);
    t[i].right = 0;
    t[i].parent = 0;
    t[i].left = 0;
  }

  for(i = 1;i <= n;i++){
    if(2*i <= n) t[i].left = t[2*i].key;
    if(2*i + 1 <=  n) t[i].right = t[2*i+1].key;
    if(i/2 > 0) t[i].parent = t[i/2].key;
  }

  for(i = 1;i <= n;i++){
    printf("node %d: key = %d, ", i, t[i].key);
    if(t[i].parent != 0) printf("parent key = %d, ", t[i].parent);
    if(t[i].left != 0) printf("left key = %d, ", t[i].left);
    if(t[i].right != 0) printf("right key = %d, ", t[i].right);
    printf("\n");
  }
  return 0; 
}

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

using namespace std;

using ll = long long;

ll dp[76];
int ps[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<int, int> cnt;
    for (int i = 2; i <= n; i++) {
        int x = i;
        for (int p : ps) {
            while (x % p == 0) {
                cnt[p]++;
                x /= p;
            }
        }
    }

    /*
    ll all = 1;
    for (int p : ps) {
        cout << p << " " << cnt[p] << endl;
        all *= cnt[p];
    }
    cout << all << endl;
    */

    dp[1] = 1;
    for (int p : ps) {
        for (int j = 75; j >= 0; j--) {
            for (int k = cnt[p]; k > 0; k--) {
                int nex = j * (k + 1);
                if (nex > 75) continue;
                dp[nex] += dp[j];
            }
        }
    }
    cout << dp[75] << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;
struct edge{ll from,to,cost;};


int  main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout<<setprecision(10);
  ll n,m;
  cin>>n>>m;
  vector<edge>edges(m);
  rep(i,m)
  {
    ll a,b,c;
    cin>>a>>b>>c;
    edges[i]={a,b,c};
  }
  bool update=0;
  ll mm=LLONG_MIN;
  vector<ll>dist(n+1,mm);
  dist[1]=0;
  rep(i,n+1)
  {
    update=0;
    rep(j,m)
    {
      if(dist[edges[j].from]==mm)continue;
      bool tmp=chmax(dist[edges[j].to],dist[edges[j].from]+edges[j].cost);
      if(edges[j].to==n)update|=tmp;
    }
  }
  if(update)cout<<"inf"<<endl;
  else cout<<dist[n]<<endl;

  return 0;

}


Measured memory_bytes: 256
#最大公約数
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

#最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

A,B=map(int,input().split())
print(lcm(A,B))

Measured memory_bytes: 38384
use std::io::*;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = AtRead::from(i);
    writeln!(o, "{}", solve(i.read_line())).unwrap();
}
fn solve(s: &str) -> usize {
    let s = s.as_bytes();
    let mut c = 0;
    for n in 1..s.len() {
        if s[n] != s[n - 1] {
            c += 1
        }
    }
    c
}

mod utils {
    use super::*;
    pub struct AtRead<R: BufRead> {
        r: R,
        s: String,
    }
    impl<R: BufRead> AtRead<R> {
        pub fn from(r: R) -> Self {
            AtRead {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }
    }
}


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

using namespace std;
 
int main()
{
    long long X;
    cin >> X;
    long long A,B;
    A = -1, B = 0 ;
    do
    {
        A++;
        B = 0;
        if (pow(A,5) > X)
        {
            do
            {
                B++;
            } while (pow(A,5)-pow(B,5) > X);
        }else if (pow(A,5) < X)
        {
            do
            {
                B--;
            } while (pow(A,5)-pow(B,5) < X);
        }
    } while (pow(A,5)-pow(B,5) != X);
    cout << A << " " << B;
}


Measured memory_bytes: 4064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <functional>

using namespace std;
typedef long long ll;

template <class Monoid>
struct SegTree
{
    using Func = function<Monoid(Monoid, Monoid)>;
    const Func F;
    const Monoid UNITY;
    int SIZE_R;
    vector<Monoid> dat;

    SegTree(int n, const Func f, const Monoid &unity) : F(f), UNITY(unity) { init(n); }
    void init(int n)
    {
        SIZE_R = 1;
        while (SIZE_R < n)
            SIZE_R *= 2;
        dat.assign(SIZE_R * 2, UNITY);
    }

    void set(int a, const Monoid &v)
    {
        dat[a + SIZE_R] = v;
    }

    void build()
    {
        for (int k = SIZE_R - 1; k > 0; --k)
        {
            dat[k] = F(dat[k * 2], dat[k * 2 + 1]);
        }
    }
    void update(int a, const Monoid &v)
    {
        int k = a + SIZE_R;
        dat[k] = v;
        while (k >>= 1)
        {
            dat[k] = F(dat[k * 2], dat[k * 2 + 1]);
        }
    }

    Monoid get(int a, int b)
    {
        Monoid vleft = UNITY, vright = UNITY;
        for (int left = a + SIZE_R, right = b + SIZE_R; left < right; left >>= 1, right >>= 1)
        {
            if (left & 1)
                vleft = F(vleft, dat[left++]);
            if (right & 1)
                vright = F(dat[--right], vright);
        }
        return F(vleft, vright);
    }
    inline Monoid operator[](int a) { return dat[a + SIZE_R]; }
    void print()
    {
        for (int i = 0; i < SIZE_R; i++)
        {
            cout << (*this)[i];
            if (i != SIZE_R - 1)
                cout << ",";
        }
        cout << endl;
    }
};

ll GCD(ll a, ll b)
{
    if (a < b)
    {
        swap(a, b);
    }

    return b ? GCD(b, a % b) : a;
}

int main()
{
    int N;
    cin >> N;

    SegTree<long long> seg(
        N, [](long long a, long long b) {
            return GCD(a, b);
        },
        0);
    vector<long long> A(N);
    for (int i = 0; i < N; ++i)
    {
        cin >> A[i];
        seg.set(i, A[i]);
    }
    seg.build();

    long long res = 0;
    for (int i = 0; i < N; ++i)
    {
        long long left = seg.get(0, i);
        long long right = seg.get(i + 1, N);
        res = max(res, GCD(left, right));
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 6128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    char s[n];
    REP(i,n){
        cin >> s[i];
        if(s[i] == 'Y'){
            cout << "Four" << endl;
            return 0;
        }
    }
    
    cout << "Three" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i;
  char c;
  for(i=0;i<3;i++){
    scanf("%c",&c);
    if(c=='7') break;
  }
  if(i!=3){
    printf("Yes");
  }else{
    printf("No");
  }
  return(0);
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  int a, b;

  function<int(int, int)> gcd = [&](int a, int b) {
    if (a % b == 0) return b;
    return gcd(b, a % b);
  };
  function<int(int, int)> lcm = [&](int a, int b) {
    return a / gcd(a, b) * b;
  };

  while (cin >> a >> b) {
    cout << gcd(a, b) << " " << lcm(a, b) << '\n';
  }
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define st first
#define nd second
#define mp make_pair
#define pii pair<int,int>

using namespace std;

const int nax = 1e6 + 5;
const int mod = 1e9 + 7;

ll pp(ll a,ll b)
{
    if(b == 0) return 1;
    ll ans = pp(a,b/2);
    ans *= ans;
    ans %= mod;
    if(b%2==1) ans *= a;
    ans %= mod;
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin>>n;
    ll ans = pp(10,n);
    ans -= pp(9,n);
    ans -= pp(9,n);
    ans += pp(8,n);
    while(ans < 0) ans += mod;
    ans %= mod;
    cout<<ans;


    return 0;

}



Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main(){
    int x[5];
    cin >> x[0] >> x[1] >> x[2] >> x[3] >> x[4];
    for(int i = 0; i < 5; i++){
        if(x[i] == 0) cout << i + 1;
    }
    return 0;
}

Measured memory_bytes: 3576
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

template <class T> void swap(T& a, T& b) { T t = std::move(a); a = std::move(b); b = std::move(t); }

int main(void)
{
    ll N, C, K, i, T[100001], cnt, ans=0, start;

    cin >> N >> C >> K;

    for(i=1; i<=N; i++){
        cin >> T[i];
    }

    sort(T+1, T+N+1);

    for(i=1; i<=N; i++){
        cnt = 1;
        start = T[i]+K;

        while(i<=N-1 && T[i+1]<=start && start<=T[i+1]+K && cnt<C){
            i++;
            cnt++;
        }
        ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
from scipy.sparse import*
n,*t=map(int,open(0).read().split())
c=sorted(t[-n:])
f=[0]*n
for i in csgraph.depth_first_order(csr_matrix(([1]*~-n,(t[:-n:2],t[1:-n:2])),[n+1]*2),1,0,0):n-=1;f[i-1]=c[n]
print(sum(c[:-1]),*f)

Measured memory_bytes: 19340
#include <iostream>
#include <vector>
#include <unordered_map>

int main() {
	int N;
	std::cin >> N;
	std::vector<int> v(N);
	std::unordered_map<int, long long int> map;
	for (int i = 0; i < N; ++i) {
		std::cin >> v[i];
		++map[v[i]];
	}

	long long int total = 0;
	for (auto it = map.begin(); it != map.end(); ++it) {
		if (it->second > 1) total += (it->second * (it->second - 1)) / 2;
	}
	for (int i = 0; i < N; ++i) {
		if (map[v[i]] > 1) std::cout << total - map[v[i]] + 1 << '\n';
		else std::cout << total << '\n';
	}

return 0;
}

Measured memory_bytes: 8392
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define era(t) t.erase(unique(be(t)),t.end())
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int n=s.length();
    int a=0,b=0,c=0;
    for(int i=0;i<n;i++){
        if(s[i]=='a')a++;
        else if(s[i]=='b')b++;
        else c++;
    }
    if(abs(a-b)<=1 && abs(b-c)<=1 && abs(c-a)<=1){
        cout << "YES"<<endl;
    }
    else{
        cout << "NO"<<endl;
    }
    return 0;
}


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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	int n;
	cin >> n;
	ll ans = 1;
	while(ans <= n){
		ans *= 2;
	}

	cout << ans/2 << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i = l; i < (n); i++)
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> p(n),q(n);
  rep(i,0,n) cin >> p.at(i);
  rep(i,0,n) cin >> q.at(i);
  
  map<vector<int>,int> m;
  int itr = 0;
  vector<int> v(n);
  rep(i,1,n+1) v.at(i-1) = i;
  do{
    m[v] = itr;
    itr++;
  }while(next_permutation(v.begin(),v.end()));
  
  cout << abs(m.at(p)-m.at(q)) << endl;
  return 0;
}

Measured memory_bytes: 5248
X,Y,Z,K = map(int,input().split())
l_a = list(map(int,input().split()))
l_b = list(map(int,input().split()))
l_c = list(map(int,input().split()))
ll = []
li = []
for i in l_a:
    for m in l_b:
        ll.append(i+m)
ll.sort(reverse = True)

del ll[K+1:]
for c in l_c:
    for i in ll:
        li.append(c+i)
li.sort(reverse = True)
for i in range(K):
    print(li[i])


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

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	LL A, B, K;
	cin >> A >> B >> K;

	int c = 0;
	for (int i = min(A, B); true; --i) {
		if ((A % i == 0) && (B % i) == 0) {
			c++;
			if (c == K) {
				cout << i << endl;
				break;
			}
		}
	}

	return 0;
}


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


using namespace std;


int main()
{
  int n, a, hash[100000]={0};

  cin >> n;
  for (int i=0; i<n; i++){
    cin >> a;
    hash[a-1]++;
    hash[a]++;
    hash[a+1]++;
  }

  sort(hash, hash+100000);
  cout << hash[99999] << endl;  
  
  return 0;
}


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

using namespace std;

const int MaxN = 2e5 + 25;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;

    cin >> s;

    if(s.size() == 26)
    {
        string ss = s;

        if(!next_permutation(ss.begin(), ss.end()))
            return cout << -1 << '\n', 0;

        string ans = ss;


        for(int pos = 0; pos < s.size(); ++pos)
        {
            bool used[26] = {};

            for(int j = 0; j < pos; ++j)
                used[s[j] - 'a'] = true;

            for(char q = s[pos] + 1; q <= 'z'; ++q)
                if(!used[q - 'a'])
                {
                    string ss;

                    for(int j = 0; j < pos; ++j)
                        ss.push_back(s[j]);

                    ss.push_back(q);

                    ans = min(ans, ss);

                    break;
                }
        }
        cout << ans << '\n';
    }else
    {
        bool used[26];
        for(int i = 0; i < 26; ++i)
            used[i] = 0;
        for(int i = 0; i < s.size(); ++i)
            used[s[i] - 'a'] = true;

        string ans = s;

        for(int i = 0; i < 26; ++i)
            if(!used[i])
            {
                ans.push_back(char('a' + i));
                break;
            }


        for(int pos = 0; pos < s.size(); ++pos)
        {
            bool used[26] = {};
            for(int j = 0; j < pos; ++j)
                used[s[j] - 'a'] = true;

            for(char q = s[pos] + 1; q <= 'z'; ++q)
                if(!used[q])
                {
                    string ss;
                    for(int j = 0; j < pos; ++j)
                        ss.push_back(s[j]);
                    ss.push_back(q);

                    ans = min(ans, ss);

                    break;
                }
        }

        cout << ans << '\n';
    }

    return 0;
}


Measured memory_bytes: 768
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		long n = long.Parse(input[0]);
		long q = long.Parse(input[1]);
    long[] nums = new long[400*400];
    long[] numSetsSumPlus = new long[400];//400*400に分割

    for(long question = 0; question < q; question++)
    {
      string[] inputq = Console.ReadLine().Split(' ');
      long howNum = long.Parse(inputq[0]);
      
      if(howNum == 0)//書き換え
      {
        long leftNum = long.Parse(inputq[1])-1;
        long rightNum = long.Parse(inputq[2])-1;
        long addNum = long.Parse(inputq[3]);
        
        long leftPosition = WherePosition(leftNum);//どの分類に属するか
        long rightPosition = WherePosition(rightNum);

        if(leftPosition+1 >= rightPosition)
        {
          for(long i = leftNum; i <= rightNum; i++)//左右の間に区間を挟まないとき
          {
            nums[i] += addNum;
          }
        }else
        {
          for(long i = leftPosition+1; i <= rightPosition-1; i++)//区間内
          {
            numSetsSumPlus[i] += addNum;
          }
          for(long i = leftNum; i <= 400*(leftPosition+1)-1; i++)//左区間外
          {
            nums[i] += addNum;
          }
          for(long i = 400*rightPosition; i <= rightNum; i++)//右区間外
          {
            nums[i] += addNum;
          }
        }

      }
      if(howNum == 1)//合計を求める
      {
        long checkNum = long.Parse(inputq[1])-1;
        long checkPosition = WherePosition(checkNum);

        Console.WriteLine(nums[checkNum] + numSetsSumPlus[checkPosition]);
      }
    }
	}

  static long WherePosition(long num)//左から何番目の分類に属するか
  {
    return num / 400;
  }
  
}


Measured memory_bytes: 22072
def solve(string):
    n, m, *ps = string.split()
    n = int(n)
    ac = [0] * n
    wa = [0] * n
    for p, s in zip(*[iter(ps)] * 2):
        p = int(p) - 1
        if s == "AC":
            ac[p] = 1
        elif not ac[p]:
            wa[p] += 1
    return "{} {}".format(sum(ac), sum([w if a else 0 for a, w in zip(ac, wa)]))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Measured memory_bytes: 18980
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

struct product {
	int price;
	int n;
};

int main(void) {
	struct product A[100];
	int count = 0;
	int sum_p = 0;
	int sum_n = 0;
	double ave_n;
	
	while(scanf("%d,%d", &A[count].price, &A[count].n) != EOF) {
		sum_p += A[count].price * A[count].n;
		sum_n += A[count].n;
		++count;
	}
	
	cout << sum_p << endl;
	ave_n = (double)sum_n / count;
	cout << round(ave_n) << endl;
	
	return 0;
}


Measured memory_bytes: 3404
#include <iostream>

using namespace std;

int main(){
    int x, y;
    cin >> x >> y;
    if(x == y) {
        cout << "a == b";
    }
    else if(x > y) {
        cout << "a > b";
    }
    else {
        cout << "a < b";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3132
#include<bits/stdc++.h>
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define pb push_back
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)
#define mod 1000000007
#define FILEIO freopen("C:/Users/Aman/Desktop/kachda/input.txt", "r", stdin); freopen("C:/Users/Aman/Desktop/kachda/output.txt", "w", stdout);

using namespace std;

signed main()
{
	//FILEIO
 	FLASH
	
	int n;
	cin>>n;
	int arr[n + 1];
	fr(i,0,n)
	{
		cin>>arr[i];
	}

	int sum_1=abs(arr[1]-arr[0]);
    if (n==2)return cout<<sum_1, 0;
	int sum_2=abs(arr[2]-arr[0]);
	
	for (int i=3 ; i<n ; i++)
	{
		int tempsum_1=sum_1 + abs(arr[i]-arr[i-2]);
		int tempsum_2=sum_2 + abs(arr[i]-arr[i-1]);

		if (tempsum_1<tempsum_2)
		{
			sum_1=sum_2;
			sum_2=tempsum_1;
		}
		else
		{
			sum_1=sum_2;
			sum_2=tempsum_2;
		}
		
	}
	cout<<sum_2;

	

}


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

#define eb emplace_back
#define pb push_back
#define INF 1LL<<62
#define FLT_INF pow(10.0, 16)

using ll = long long;
using vll = vector<ll>;
using ull = unsigned long long;
using int2 = pair<int, int>;
using int3 = tuple<ll, ll, ll>;

template <typename A> string to_string(const A& v);
string to_string(const string& s) { return '"'+ s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(const pair<A, B>& p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C> string to_string(const tuple<A, B, C>& p) {
  return "(" + to_string(std::get<0>(p)) + ", " + to_string(std::get<1>(p)) +  ", " + to_string(std::get<2>(p)) + ")";
}

template <typename A> string to_string(const A& v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename T>
void sort(vector<T>& val) {
  sort(val.begin(), val.end());
}

template <typename T>
void sort_b(vector<T>& val) {
  sort(val.begin(), val.end(), greater<T>());
}

template <typename T>
T mul_mod(T a, T b, T mod) {
  T res = 0;
  a %= mod;
  while (b) {
    if (b & 1) {
      res = (res + a) % mod;
    }
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...);
#endif

#define COMMON_MOD pow(10, 9) + 7
#define PI 3.14159265

// sort(a.begin(), a.end(), less<ll>()); greater<ll>()
// cout<<fixed<<setprecision(20)<<(s/kl)*2;
/* printf("%lld %lld \n", cur_n, m / 2 + 1);
*/

class mytask {
public:
  mytask() { }

  int solve() {

    ll n;
    cin >> n;

    vll a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }

    ll wrong_nums = 0;
    for (int i = 0; i < n-1; i++) {
      if (a[i] != (i + 1)) {
        wrong_nums++;
      }
    }

    if (wrong_nums <= 2) {
      cout << "YES";
    } else {
      cout << "NO";
    }






    return 0;
  }
};


int main() {

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

  auto task = mytask();
  task.solve();

  cout << endl;

  return 0;
}


Measured memory_bytes: 256
N, M, X = map(int, input().split())
A = list(map(int, input().split()))
cost_for_0 = 0
cost_for_N = 0
for i in range(X):
    if i in A:
        cost_for_0 += 1
for i in range(X, N + 1):
    if i in A:
        cost_for_N += 1

print(min(cost_for_0, cost_for_N))


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main() {
  int x, a, b;
  cin >> x >> a >> b;

  if (b <= a) {
    cout << "delicious" << endl;
  } else if ( b <= (a + x)) {
    cout << "safe" << endl;
  } else {
    cout << "dangerous" << endl;
  }
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    int n, a;
    cin >> n >> a;
    if (n % 500 <= a)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
import re
S = input()

po=[]
ne=[]
li = [m.span()[0] for m in re.finditer('><', S)]
result = []
n = 0
for i in S:
    if i == "<":
        n += 1
    else:
        break
po.append(n)
for i in li:
    s = "<"
    n = 0
    while s == S[i+1]:
        n += 1
        i += 1
        if i+1 >= len(S):
            break
    po.append(n)
for i in li:
    s = ">"
    n = 0
    while s == S[i]:
        n += 1
        i -= 1
        if i < 0:
            break
    ne.append(n)
n = 0
for i in S[::-1]:
    if i == ">":
        n += 1
    else:
        break
ne.append(n)
for i,l in enumerate(po):
    if l < ne[i]:
        if l > 0:
            result.append((1/2)*(l-1)*l)
        if ne[i] > 0:
            result.append((1/2)*ne[i]*(ne[i]+1))
    else:
        if l > 0:
            result.append((1/2)*l*(l+1))
        if ne[i] > 0:
            result.append((1/2)*ne[i]*(ne[i]-1))
print(int(sum(result)))

Measured memory_bytes: 19292
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <cmath>
#include <cstring>
#include <assert.h>
#include <utility>
#include <tuple>
#include <array>
#include <bitset>
#include <cstdlib>
#include <complex>

using int64 = long long;
using uint64 = unsigned long long;

using namespace std;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int n;
    int64 d, a;
    cin >> n >> d >> a;
    vector<tuple<int64, int64>> xhs;
    for (int i = 0; i < n; i++) {
        int64 x, h;
        cin >> x >> h;
        xhs.emplace_back(x, h);
    }
    sort(xhs.begin(), xhs.end());
    vector<int64> counter(n + 1, 0);

    int64 ans = 0;
    for (int i = 0; i < n; i++) {
        if (i > 0) counter[i] += counter[i - 1];
        int64 x, h;
        tie(x, h) = xhs[i];

        int end = upper_bound(xhs.begin(), xhs.end(), make_tuple(x + 2 * d, (1LL << 60))) - xhs.begin();
        int64 num_bombs = max(0LL, (h - counter[i] * a + a - 1) / a);
        counter[i] += num_bombs;
        counter[end] -= num_bombs;
        ans += num_bombs;
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 6128