akhauriyash/Code-Regression huggingface dataset:
s = input().split()
n=int(s[0])

s=(input().split())

list=[[0 for i in range(2)] for j in range(n)]


for i in range(n):
    list[i][1]=i
    list[i][0]=int(s[i])

list.sort()

#print('list = {}'.format(list))
answer=[]
for i in range(n):
    print(list[i][1]+1)
    #list.append(list[i][1]+1)

#print(answer)


Measured memory_bytes: 28472
A, B, C = input().split()
if A == B == C:
    print('No')
elif A == B:
    if A != C:
        print('Yes')
elif A == C:
    if A != B:
        print('Yes')
elif B == C:
    if B != A:
        print('Yes')

else:
    print('No')
        

Measured memory_bytes: 2940
parseInt(x) = parse(Int,x)

parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    c = readline()[1]

    if c=='a'||c=='i'||c=='u'||c=='e'||c=='o'
        println("vowel")
    else
        println("consonant")
    end
end

main()


Measured memory_bytes: 108284
#include<iostream>
#include<set>
#include<algorithm>
using namespace std;

int main(){
    set<int> a, b, c;
    int n, m, x;
    
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> x;
        a.insert(x);
    }
    cin >> m;
    for(int i = 0; i < m; i++){
        cin >> x;
        b.insert(x);
    }

    set_union(a.begin(), a.end(), b.begin(), b.end(), inserter(c, c.end()));

    for(int x : c)  printf("%d\n", x);

    return 0;
}


Measured memory_bytes: 40656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll h, w;
  in2(h, w);
  vector<vector<char>> a(h + 2, vector<char> (w + 2, '0'));
  rep(i, h){
    rep(j, w){
      in(a[i + 1][j + 1]);
      if(a[i + 1][j + 1] == '.')
        a[i + 1][j + 1] = '0';
    }
  }
  rep2(i, 1, h + 1){
    rep2(j, 1, w + 1){
      if(a[i][j] == '#')
        continue;
      if(a[i - 1][j] == '#')
        a[i][j]++;
      if(a[i - 1][j - 1] == '#')
        a[i][j]++;
      if(a[i - 1][j + 1] == '#')
        a[i][j]++;
      if(a[i][j + 1] == '#')
        a[i][j]++;
      if(a[i][j - 1] == '#')
        a[i][j]++;
      if(a[i + 1][j - 1] == '#')
        a[i][j]++;
      if(a[i + 1][j] == '#')
        a[i][j]++;
      if(a[i + 1][j + 1] == '#')
        a[i][j]++;
    }
  }
  rep(i, h){
    rep(j, w)
      out(a[i + 1][j + 1]);
    memi;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
		using namespace std;
		typedef long long ll;
		#define PI 3.14159265358979
		#define EPS 1e-8
		#define mod  998244353
		#define fi first
		#define se second
		#define mp make_pair
		#define pb push_back
		#define endl "\n"
			 
		const ll INF=1e15;	
		const int N=2e5+50;
		 

		 
		long long binpow(long long a, long long b, long long m) {
			a %= m;
			long long res = 1;
			while (b > 0) {
				if (b & 1)
					res = res * a % m;
				a = a * a % m;
				b >>= 1;
			}
			return res;
		}
		
		ll modinverse(ll a,ll m)
		{
			return binpow(a,m-2,m);
		}
		
			
		
		
		int main()
		{
			ios_base::sync_with_stdio(false);
			cin.tie(NULL);cout.tie(0);
		
					
			ll n;
			cin>>n;
			
			vector<ll> v(n+1),pref_sum(n+1,0),pref_xor(n+1,0);
			
			
			
			for(ll i=1;i<=n;i++)
			{
				cin>>v[i];
				pref_sum[i]=v[i]+pref_sum[i-1];
				pref_xor[i]=v[i]^pref_xor[i-1];
			}
			
			ll i=1,j=1,cnt=0;
			
			while(j<=n )
			{
				if((pref_sum[j]-pref_sum[i-1] )== (pref_xor[j]^pref_xor[i-1]) )
				{
					j++;
					cnt+=(j-i);
				
				}
				else
				{
					i++;
				}
			}
	
			
			cout<<cnt;
		}
			
			
		


Measured memory_bytes: 7912
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int gcd(int a,int b){return b?gcd(b,a%b):a;}    //最大公約数
int lcm(int a, int b) {return a * b / gcd(a, b);}   //最小公倍数

int main()
{
    int n;
    cin >> n;
    int h[n];
    REP(i,n)
    cin >> h[i];
    int old = h[0];
    int count = 0;
    int count_max = 0;
    REP2(i,1,n)
    {
        int now = h[i];
        if(old>=now){
            count++;
            old = now;
        }
        else{
            count_max = max(count, count_max);
            count = 0;
            old = now;
        }
    }
    count_max = max(count, count_max);
    cout << count_max << endl;
}

Measured memory_bytes: 640
#data????§???????[y???][x???]??§??????

if __name__ == "__main__":
    while 1:
        w,h = list(map(int,input().strip().split()))
        if w == h == 0:break
        data = []
        data = []
        for _ in range(h):data.append(list(input()))
        visited = []
        position =(0,0)
        for i in range(h):
            if '@'in data[i]:position = (i,data[i].index('@'))
        stack = []
        count = 0
        stack.append(position)
        while len(stack) !=0:
            position = stack.pop()
            count +=1
            if position[0] -1 >= 0 and not (position[0]-1,position[1])in visited and data[position[0] -1][position[1]] == '.':
                visited.append((position[0] -1,position[1]))
                stack.append((position[0] -1,position[1]))
            if position[1] -1 >= 0 and not (position[0],position[1]-1)in visited and data[position[0]][position[1]-1] == '.':
                visited.append((position[0],position[1]-1))
                stack.append((position[0],position[1]-1))
            if position[0] +1 < h and not (position[0]+1,position[1])in visited and data[position[0] +1][position[1]] == '.':
                visited.append((position[0]+1,position[1]))
                stack.append((position[0]+1,position[1]))
            if position[1] + 1 < w and not (position[0],position[1]+1)in visited and data[position[0]][position[1] +1] == '.':
                visited.append((position[0],position[1] +1))
                stack.append((position[0],position[1]+1))

        print(count)

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;

int d,c[30],s[370][30];
int cost[30];

int main(){

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

    cin>>d;
    for(int i=1;i<=26;i++){
        cin>>c[i];
    }
    memcpy(cost,c,sizeof(cost));
    for(int i=1;i<=d;i++){
        for(int j=1;j<=26;j++){
            cin>>s[i][j];
        }
    }
    for(int cur=1;cur<=d;cur++){
        int sum=0;
        for(int i=1;i<=26;i++)sum+=cost[i];
        int con=rng()%sum+1;
        for(int i=1;i<=26;i++){
            if(con<=cost[i]){
                for(int j=1;j<=26;j++){
                    if(i==j)cost[j]=c[j];
                    else cost[j]+=c[j];
                }
                cout<<i<<endl;
                break;
            }
            con-=cost[i];
        }
    }

    return 0;
}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
using namespace std;
int fact(int n)
{
	if(n==0)
		return 1;
	return n*fact(n-1);
}

int main()
{
	int n,a[10],b[10],x=0,y=0,i,j;
	cin>>n;
	for(i=1;i<=n;i++)
		cin>>a[i];
	for(i=1;i<=n;i++)
		cin>>b[i];
	for(i=1;i<=n;i++)
	{
		int c=0,d=0;
		for(j=i+1;j<=n;j++)
			if(a[j]<a[i])
				c++;
		
		for(j=i+1;j<=n;j++)
			if(b[j]<b[i])
				d++;
		
		x+=fact(n-i)*c;
		y+=fact(n-i)*d;
		//cout<<"x is "<<x<<"y is "<<y<<endl;
		
	}

	x++;
	y++;
	cout<<abs(x-y)<<endl;
	
}

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */
	NodePointer cur = nil->next;
	while(cur!=nil && cur->key!=key){
		cur=cur->next;
	}
	return cur;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
	if(t==nil){
		return;
	}
	t->prev->next=t->next;
	t->next->prev=t->prev;
	free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  /* your code */
	NodePointer t = nil->prev;
	deleteNode(t);
}

void delete(int key){
  /* your code */
	NodePointer t;
	t=listSearch(key);
	deleteNode(t);
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
  /* 

   your code 


  */

}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
		if ( com[6] == 'F' ) deleteFirst();
		else if ( com[6] == 'L' ) deleteLast();
      } else {
		delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}


Measured memory_bytes: 32968
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
using namespace std;
int list[10000][6];
int ko[10000][4];
bool check(int a,int b,int c,int d){
	int e[10]={0};
	e[a]++;e[b]++;e[c]++;e[d]++;
	for(int i=0;i<10;i++)if(e[i]>1)return 0;
	return 1;
}

int main(){
	int N;
	while(cin>>N,N){
		int C,H,B;
		int cnt=0;
		for(int i=0;i<N;i++){
			for(int j=3;j<6;j++)cin>>list[i][j];
			for(int j=3;j>0;j--){
				list[i][j-1]=list[i][j]/10;
				list[i][j]%=10;
			}
		}
		for(int i=0;i<=9;i++){
			for(int j=0;j<=9;j++){
				for(int k=0;k<=9;k++){
					for(int l=0;l<=9;l++){
						if(check(i,j,k,l)){
							int flag=1;
							for(int m=0,h,b;m<N;m++){
								h=0;
								b=0;
								if(list[m][0]==i)h++;
								if(list[m][1]==j)h++;
								if(list[m][2]==k)h++;
								if(list[m][3]==l)h++;
								
								if(list[m][0]==j  || list[m][0]==k  || list[m][0]==l )b++;
								if(list[m][1]==i  || list[m][1]==k  || list[m][1]==l )b++;
								if(list[m][2]==i  || list[m][2]==j  || list[m][2]==l )b++;
								if(list[m][3]==i  || list[m][3]==j  || list[m][3]==k )b++;
								
								if(!(list[m][4]==h&&list[m][5]==b))flag=0;
							}
							if(flag){
								ko[cnt][0]=i;
								ko[cnt][1]=j;
								ko[cnt][2]=k;
								ko[cnt][3]=l;
								cnt++;
							}
						}
					}
				}
			}
		}
		
		if(cnt==1){
			for(int i=0;i<4;i++)cout<<ko[0][i];
			cout<<endl;
		}
		else{
			int que=-1;
			int d[6];
			for(d[4]=0123;d[4]<=9876&&que<0;d[4]++){
				d[3]=d[4];
				for(d[6]=3;d[6]>0;d[6]--){
					d[d[6]-1]=d[d[6]]/10;
					d[d[6]]%=10;
				}
				if(check(d[0],d[1],d[2],d[3])){
					int hb[5][5]={0};
					for(int i=0;i<cnt;i++){
						int h=0,b=0;
						for(int j=0;j<4;j++)if(ko[i][j]==d[j])h++;
						for(int j=0;j<4;j++)for(int k=0;k<4;k++)if(ko[i][j]==d[k])b++;
						b-=h;
						hb[h][b]++;
					}
					int flag=1;
					for(int i=0;i<5;i++)for(int j=0;j<5;j++)if(hb[i][j]>1)flag=0;
					if(flag){
						que=d[0]*1000+d[1]*100+d[2]*10+d[3];
						for(int i=0;i<4;i++)cout<<d[i];
						cout<<endl;
					}
				}
			}
			if(que<0)cout<<"????"<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 1188
#include <iostream>

using namespace std;

int main()
{
    int n;
    while(cin >> n)
    {
        int cnt = 0;
        int x;
        for(int i = 0;i<n;i++)
        {
            cin >>x;
            if(x%2==1)
                cnt++;
        }
        if(cnt%2==0)cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string> 
using namespace std;
int main()
{
	int a,sum=0,cpya;
	cin>>a;
	for(int i=0;i<4;i++)
	{
		cpya=a%10;
		a=a/10;
		if(cpya==2)
			sum++;
	}	
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	defer stdout.Flush()
	N := readInt()
	ans := 0
	for N > 0 {
		ans += N % 10
		N /= 10
	}
	if ans == 1 {
		ans = 10
	}
	println(ans)
}

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

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

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	i, err := strconv.Atoi(readString())
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}


Measured memory_bytes: 640
a,square,qqq,b,c,qqqq,qqqqq=  list(map(int,input().split()))

a_ = a%2
b_ = b%2
c_ = c%2

b_sub = b-b_
c_sub = c-c_

if b_==1 and c_==1 and a>0:
    a=a-1
    a_ = a%2
    a_sub = a-a_
    print(a_sub+b_sub+c_sub+3+square)
elif a_==1 and c_==1 and b>0:
    a_sub = a-a_
    b = b-1
    b_ = b%2
    b_sub=b-b_
    print(a_sub+b_sub+c_sub+3+square)
elif a_==1 and b_==1 and c>0:
    a_sub = a-a_
    c = c-1
    c_ = c%2
    c_sub=c-c_
    print(a_sub+b_sub+c_sub+3+square)    
else:
    a_ = a%2
    a_sub = a-a_
    print(a_sub+b_sub+c_sub+square)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, k;
	cin >> n >> k;
	long long tmp=1;
	for(int i=0;i<n;i++)
		if(i==0)
			tmp*=k;
		else
			tmp*=(k-1);
	cout << tmp << endl;
}


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


int main(){
    unsigned long N,i,M,sum;

    scanf("%ld", &N);

    sum = N * (double)(N + 1) / 2.0;
    M = 0;
    for (i = 0; i <= N; i+=3)
    {
        M += i;
    }
    for (i = 0; i <= N; i += 5)
    {
        if(i % 3 == 0){
            continue;
        }
        M += i;
    }

    printf("%ld",sum - M);

    return 0;
}


Measured memory_bytes: 1732
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;
 
#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int a[501][501];
string ans[250001];

int main() {
  ll n, m;
  cin >> n >> m;
  if(n == 1 && m == 1){
    cout << 1 << endl;
  }else if(n*m==2){
    cout << 0 << endl;
  }else if(n == 1 || m == 1){
    cout << n*m -2 << endl;
  }else{
    cout << (n-2)*(m-2) << endl;
  }
}


Measured memory_bytes: 2176
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<iomanip>
#include<set>
#include<queue>
#include<deque>
#include<sstream>
#include<cmath>
#include<bitset>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(int i = n-1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long int ll;
typedef long double ld;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
const int MAX = 510000;
const int MOD = 1000000007;
const int inf = 1<<31-1;
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; }
int main(void) {
    int n; cin >> n;
    vector<ll> dp(n + 1, 0);
    dp[0] = 1;
    rep(i, n-2) {
        for(int j = i+3;j<=n;j++) dp[j] += dp[i],dp[j]%=MOD;
    }cout << dp[n] << endl;
}

Measured memory_bytes: 3644
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            final String sl[] = s.split(" ");
            int N = Integer.parseInt(sl[0]);
            int A = Integer.parseInt(sl[1]);
            int B = Integer.parseInt(sl[2]);

            System.out.println(Math.min(N * A, B));
        }
    }
}


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

int main() {
  long long x,ans = 0;
  cin >> x;
  ans += (x/11)*2;
  x %= 11;
  if(x != 0){
    if(x <= 6) ans++;
    else ans += 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define rev(i, n) for(int i = n;i >= 0;i--)
#define repeat(i, m, n) for(int i = m;i < n;i++)
#define repeatrev(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define itn int

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef priority_queue<int> Pr;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll int x, y;
    cin >> x >> y;
    if(x == y) cout << 0 << endl;
    else if (x==0){
        if( y > 0) cout << y << endl;
        else cout << 1 - y<< endl;
    }else if (y == 0){
        if(x > 0) cout << 1 + x << endl;
        else cout << -x << endl;
    }
    else {
        if (x >= 0 && y >= 0) {
            if (x < y) cout << y - x << endl;
            else cout << 2 + x - y << endl;
        } else if (x < 0 && y > 0) {
            if (abs(x) > y) cout << -x - y + 1 << endl;
            else cout << 1 + x + y << endl;
        } else if (x > 0 && y < 0) {
            if (abs(x) > abs(y)) cout << 1 + x + y << endl;
            else cout << -y - x + 1 << endl;
        } else if (x < 0 && y < 0) {
            if (abs(x) > abs(y)) cout << -x + y << endl;
            else cout << 2 + x - y << endl;
        }
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll //9223372036854775807
#define pi acos(-1.0)
#define ms(a,b) memset(a,b,sizeof(a))
#define nl "\n"
#define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
typedef long long ll;
const int mod = 998244353;
//ll qpow(ll x, ll y){ll s=1;while(y){if(y&1)s=s*x%mod;x=x*x%mod;y>>=1;}return s;}
ll qpow(ll a, ll b){ll s=1;while(b>0){if(b%2==1)s=s*a;a=a*a;b=b>>1;}return s;}
inline ll read(){ll x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();return x*f;}
ll inve(ll x){return x==1?1:(mod-mod/x)*inve(mod%x)%mod;}

const int N = 1e6;

int main()
{
    int a, b, vis[5] = {0};
    for(int i=1;i<=3;i++)
    {
        cin>>a>>b;
        vis[a]++,vis[b]++;
    }
    for(int i=1;i<=4;i++)
    {
        if(vis[i]>=3) return puts("NO"),0;
    }
    puts("YES");


    return 0;
}


Measured memory_bytes: 256
from collections import deque
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
r=[[] for i in range(n+1)]
R=[[] for i in range(n+1)]
for i in range(m):
    a,b=map(int,input().split())
    r[a].append(b)
    r[b].append(a)
    R[a].append(b)
    R[b].append(a)
dep=[-1]*(n+1)
dep[0]=0
dep[1]=0
data=deque([1])
d=0
while len(data)>0:
    p=data.popleft()
    for i in r[p]:
        if dep[i]==-1:
            dep[i]=dep[p]+1
            data.append(i)
    r[p]=[]
if not all(dep[i+1]>=0 for i in range(n)):
    print("No")
else:
    print("Yes")
    for i in range(2,n+1):
        for j in R[i]:
            if dep[j]==dep[i]-1:
                print(j)
                break



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

int main(){
	string S,T;
  cin>>S>>T;
  int N=S.size();
  S+=S;
  int count=0;
  
  for(int i=0;i<N;i++)
    if(S.at(i)==T.at(0)){
    	for(int j=0;j<N;j++){
        	if(S.at(i+j)!=T.at(j))
              break;
          count++;
        }
      if(count==N)
        break;
      else
        count=0;
    }
  if(count==N)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

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

using namespace std;
 
using ll = long long;
using ull = unsigned long long;
using ldouble = long double;
 
const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;


int main()
{
    ll a, b, c;
    cin >> a >> b >> c;

    println((a^b^c));
}


Measured memory_bytes: 3572
#include <stdio.h>

int main()
{
	int W, a, b;
	scanf("%d %d %d", &W, &a, &b);
	if (b > a + W) printf("%d\n", b - a - W);
	else if (a > b + W) printf("%d\n", a - b - W);
	else printf("0\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1688
/* package codechef; // don't place package name! */

import java.util.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main {
    public static void main (String[] args) {
        // your code goes here
        Scanner s = new Scanner(System.in);
        int j = 0;
        for(int i=0; i<5; i++)
        {
            int x = s.nextInt();
            if(x==0)
                j=i+1;
        }
        System.out.println(j);

    }
}


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


int main()
{
	int S, h, m, s;
	cin >> S;
	h = S / 3600;
	m = (S % 3600)/60;
	s = (S % 3600) % 60;
	cout << h << ":" << m << ":" << s<<"\n";
    return 0;
}



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

using namespace std;

int main()
{
    pair<pair<string, int>, int> p[110];
    int a;
    cin >> a;
    for (int i = 0; i < a; i++) {
        int t;
        string s;
        cin >> s >> t;
        p[i] = make_pair(make_pair(s, -t), i);
    }
    sort(p, p+a);
    for (int i = 0; i < a;i++)
        cout << p[i].second + 1 << endl;
}


Measured memory_bytes: 256
/**
 * Я слил Atcoder Beginner Contest 172, решив всего две задачи!
 * Я не могу апнуть синего!
 * Я постоянно сливаю раунды, либо не решив тупую задачу, либо набрав штрафа!
 * Я постоянно уступаю всем своим друзьям и знакомым в контестах и нахожу этому оправдания!
 * Я постоянно придумываю сложные неверные решения к простым задачам!
 * -------------------------------------------------------------
 * -Решать сложные задачи
 * -Участвовать в контестах
 * -Делать виртуальные соревнования
 * -------------------------------------------------------------
 * Не уберу это, пока не начну нормально решать задачи, а не заниматься ерундой!!!
**/
  
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
typedef long long  ll;
//typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set
// this for long double
#define press_F_to_pay_respect ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn for(int i=0;i<n;i++) 
#define form for(int j=0;j<n;j++) 
#define fore(i,a,b) for(int i = a; i < (b); i++)
#define pb push_back 
#define pob pop_back()
#define mp make_pair 
#define sc second 
#define f first 
#define ld long double
#define kek cout<<endl; 
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(v) ((v).begin()), ((v).end()) 
#define pob pop_back() 
#define halt {cout<<-1; return 0;}
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const int N = 1010;
const int INF = 1e8;
const ll MOD1=1073741824;
const long double pi=3.1415926535;
using namespace std;
using namespace __gnu_pbds;
typedef tree<ld,null_type,less<ld>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
string bin_rep(int n)
{
          string s="";
      for(int i=31;i>=0;i--)
   {
           if(n&(1<<i)) s+='1';
           else s+='0';
   }
   return s;
}
int main()
{
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
 press_F_to_pay_respect;
 // cout << fixed << setprecision(12) << ans;
 // string al = "abcdefghijklmnopqrstuvwxyz";
int n;
cin>>n;
vector<ll> v(n);
forn cin>>v[i];
sort(all(v));
int cnt=0;
while(cnt!=n-1)
{
          ll f;
          cnt=0;
          int pos=1;
          forn
          {
                    if(v[i]!=0) {f=v[i]; pos=i; break;}
          }
          for(int i=pos+1;i<n;i++) 
          {
                    v[i]%=f;
          }
          forn
          {
                    if(v[i]==0) cnt++;
          }
          sort(all(v));
}
cout<<v[n-1];

 
    
 
 
 
  // cout <<"Runtime is:"<<clock() * 1.0 / CLOCKS_PER_SEC <<endl;
   return 0;
   
   
 
}

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

const int MAXN = 1005;

int H, W, d[MAXN][MAXN];
char A[MAXN][MAXN];

int di[] = {1, -1, 0, 0};
int dj[] = {0, 0, 1, -1};

int main(){	
	scanf("%d %d", &H, &W);
	
	memset(d, -1, sizeof d);
	
	queue < pair <int, int> > q;
	for(int i = 0; i < H; i++){
		scanf("%s", A[i]);
		for(int j = 0; j < W; j++){
			if(A[i][j] == '#'){
				q.push(make_pair(i, j));
				d[i][j] = 0;
			}
		}
	}
	
	int mx = 0;
	
	while(!q.empty()){
		pair <int, int> u = q.front();
		q.pop();
		
		mx = max(mx, d[u.first][u.second]);
		
		for(int dir = 0; dir < 4; dir++){
			int ui = u.first + di[dir], uj = u.second + dj[dir];
			
			if(ui < 0 || ui >= H || uj < 0 || uj >= W)continue;
			if(d[ui][uj] != -1)continue;
			
			q.push(make_pair(ui, uj));
			d[ui][uj] = d[u.first][u.second] + 1;
		}
	}
	
	printf("%d\n", mx);
	
	return 0;
}


Measured memory_bytes: 13328
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        int x = 0;
        int max = 0;
        for (int i = 0 ; i < N ; i++ ) {
            if (S.charAt(i) == 'I') {
                x++;
            } else if (S.charAt(i) == 'D') {
                x--;
            }
            max = Math.max(max, x);

        }
        System.out.println(max);
    }

}

Measured memory_bytes: 20820
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>

using namespace std;


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

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

   cout << a.back() - a.front() << endl;
   return 0;
}


Measured memory_bytes: 256
import sys
import itertools

input = sys.stdin.readline

def slove():
    n = int(input())
    P = tuple(map(int,input().split()))
    Q = tuple(map(int,input().split()))
    """
    print(P)
    print(Q)
    """
    count = 0
    for item in itertools.permutations(range(1,1+n)):
        if P == item:
            a = count
        if Q == item:
            b = count
        count += 1
    print(abs(a-b))


if __name__ == "__main__":
    slove()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int a; cin >> a;
    string s; cin >> s;

    if (a >= 3200) {
        cout << s << endl;
    } else {
        cout << "red" << endl;
    }


}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i,x,a,b;

  scanf("%d",&x);
  scanf("%d",&a);
  scanf("%d",&b);

  x=x-a;
  for(i=0;x-b>=0;i++){
    x=x-b;
  }
  printf("%d",x);
  return 0;
}


Measured memory_bytes: 128
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        List<Character> list = Arrays.asList('A', 'C', 'G', 'T');

        int ans = 0;
        int candidate = 0;
        for (int i = 0; i < s.length(); i++) {
            if (list.contains(s.charAt(i))) {
                candidate++;
                if (candidate > ans) {
                    ans = candidate;
                }
            } else {
                candidate = 0;
            }
        }

        System.out.println(ans);
    }

}


Measured memory_bytes: 23764
#include<cstdio>
#include<cstring>
#define inlien inline
#define retrun return
#define cpnst const
int n;
int v[111111],d[111111],x[111111],y[111111];
char str[111111];
bool del[111111];
#include<vector>
std::vector<int>e[111111],ee[111111];
#include<queue>
std::queue<int>q;
int F[111111];
inline int max(int x,int y)
{return(x>y)?x:y;}
inline int solve(int S,int f=-1)
{
	int ret=0;
	for(register int i=0;i<ee[S].size();i++)
	{
		if(ee[S][i]==f)continue;
		ret=max(ret,solve(ee[S][i],S));
		if(F[S]+F[ee[S][i]]>ret)ret=F[S]+F[ee[S][i]];
		F[S]=max(F[S],F[ee[S][i]]+v[S]);
	}return ret;
}
int main()
{
	scanf("%d",&n);
	if(!n)retrun puts("0"),0;
	register int i;
	for(i=1;i<n;i++)
		scanf("%d%d",x+i,y+i),d[x[i]]++,d[y[i]]++,
		e[x[i]].push_back(y[i]),e[y[i]].push_back(x[i]);
	scanf("%s",str+1);
	for(i=1;i<=n;i++)
		if(d[i]==1)q.push(i);
	for(;q.size();)
	{
		int p=q.front();q.pop();
        if(del[p])continue;
		if(str[p]=='W')continue;
		del[p]=1;
		for(i=0;i<e[p].size();i++)
		{
			int to=e[p][i];
			if(del[to])continue;
			d[to]--;
			if(d[to]==1)q.push(to);
		}
	}for(i=1;i<=n;i++)d[i]=0;
	for(i=1;i<n;i++)
		if(!del[x[i]])
			if(!del[y[i]])
				d[x[i]]++,ee[x[i]].push_back(y[i]),
				d[y[i]]++,ee[y[i]].push_back(x[i]);
	int ans=0;
	for(i=1;i<=n;i++)
		if(!del[i])v[i]=(str[i]=='W')^(d[i]&1),ans+=v[i]+d[i];
	for(i=1;i<=n;i++)
		if(!del[i])return printf("%d\n",ans-solve(i)*2),0;
	return puts("0"),0;
}
/*
Giving the world a better yourself is giving yourself a better world. 
*/


Measured memory_bytes: 17792
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  int A, B, C; cin >> A >> B >> C;

  if (max(A, B) >= C and min(A, B) <= C) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main()
{
    int a[3][3];
    int ans[3][3]={0};
    
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>a[i][j];
        }
    }
    
    int n;
    cin>>n;
    
    while(n--)
    {
        int x;
        cin>>x;
        
        for(int i=0;i<3;i++)
        {
            for(int j=0;j<3;j++)
            {
                if(a[i][j]==x)
                {
                    ans[i][j]=1;
                }
            }
        }
    }
    
    
    
    int flag1=0,flag2=0,flag3=0,flag4=0;
        for(int i=0;i<3;i++)
        {
            if(ans[i][0]==1 && ans[i][1]==1 && ans[i][2]==1)
            {
                flag1=1;
                break;
            }
            
            if(ans[0][i]==1 && ans[1][i] ==1 && ans[2][i]==1)
            {
                flag2=1;
                break;
            }
        }
        
        if(ans[0][0]==1 && ans[1][1]==1 && ans[2][2]==1 )
        {
            flag3=1;
        }
        
        if(ans[0][2]==1 && ans[1][1]==1 && ans[2][0]==1)
        {
            flag4=1;
        }
       
       if(flag1==1 || flag2==1 || flag3==1 || flag4==1 )
       {
           cout<<"Yes"<<endl;
       }
       
       else
       {
           cout<<"No"<<endl;
       }
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  int	n,max=1;
  
  scanf("%d", &n);
  
  while(max < n){
    max*=2;
  }
  
  if (max>n) max=max/2;
  
  printf("%d", max);
    
    return 0;
}

Measured memory_bytes: 128
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;



int main() {
  long long n,a,b;
  
  cin>>n>>a>>b;
  cout<<max((n-1)*b+a-(n-1)*a-b+1,0ll);
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long 
#define lli long long int
#define vpl vector < pair < ll,ll > >
#define vll vector < ll >
#define pll pair <ll,ll>
#define mll map< ll,ll >
#define ins insert
#define mkp make_pair
#define reverse(s) reverse(s.begin(), s.end())

#define mem(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define cn(a) cout<<a<<"\n"
#define cp(a) cout<<a
#define cs(a) cout<<a<<" "
#define fr(a,n,i) for(ll i=a; i<n; i++ )
#define frn(a,n,i) for(ll i=a; i>=n; i--)
#define fre(a,n,i) for(ll i=a; i<=n; i++)

using namespace std;
ll mod=1e9 +7;
 bool comp(pll p,pll q)
{
    if(p.first!=q.first)
    return p.first<q.first;
    else
    return p.second>q.second;
}
ll power(ll a,ll n)
{
	ll res=1;
 
	while(n){
		if(n%2)
		res=(res%mod*a%mod)%mod;
		a=(a%mod*a%mod)%mod;
		n/=2;
	}
  return res%mod;
} 
ll kmp(string x,ll m)
{
      
      vector<ll> pi(m,0);
      pi[0]=0;ll ma=0;ll j=0;
      for(ll i=1;i<m;i++)
        {
      while(j>0 && x[i]!=x[j])
        j=pi[j-1];
        if(x[j]==x[i])
        j++;
        pi[i]=j;
        }
        return j;
}

 

    
int32_t main()
{
    fast;
 ll n,l,r,ma=0,mi=INT_MAX,ans=0; vpl v;

cin>>n;



fr(0,n,i)

{

cin>>l>>r;

v.pb({l,r});
mi=min(mi,r);
ma=max(ma,l);

}
 

vpl a;

fr(0,n,i)
ans=max(ans,v[i].second-v[i].first+1);

ans+=max(0LL,mi-ma+1);


fr(0,n,i)
a.pb({max(0LL,v[i].second-ma+1),max(0LL,mi-v[i].first+1)});
    
sort(a.begin(),a.end());

ll b[n];  b[0]=a[0].second;
fr(1,n,i)
b[i]=min(b[i-1],a[i].second);



fr(1,n,i)

{
ans=max(ans,a[i].first+b[i-1]);

} 



cp(ans);

 
}

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


int main(){
    long long ans;
    long long a,b,x;

    cin >> a;
    cin >> b;
    cin >> x;
    if(a == 0){
        ans =  b/x + 1;
    }else{
        ans = b/x - (a-1)/x;
    }
    
    //if(a%x == 0  || b%x == 0){
        //ans++;
    //}

    cout << ans <<"\n";

    return 0;
}

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

using namespace std;

int main()
{
	vector<int> mss;
	for(int i=0;i<500000;i+=7){
		mss.push_back(i+1);
		mss.push_back(i+6);
	}
	vector<int> msps;
	for(int i=1;i<mss.size();i++){
		bool ismsp=true;
		for(int j=0;j<msps.size() && msps[j]*msps[j]<=mss[i];j++){
			if(mss[i]%msps[j]==0)
				ismsp=false;
		}
		if(ismsp)
			msps.push_back(mss[i]);
	}
	
	for(int n;cin>>n,n!=1;){
		cout<<n<<":";
		for(int i=0;i<msps.size();i++)
			if(n%msps[i]==0)
				cout<<" "<<msps[i];
		cout<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1952
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++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(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    int digits = log10(n);
    int ans = 0;

    if(digits%2==0) ans = n;
    for(int i=digits-1; i >=0; i--) {
        if(i%2==0) ans += pow(10, i+1) - 1;
        else ans -= pow(10, i+1) - 1 ;
    }

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

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5;
const ll INF = 0x3f3f3f3f3f3f3f3f;
#define DEBUG(x) cout << x << '\n'

ll n, a[MAXN], b[MAXN];
int main(){
    #ifdef Irene
    freopen("in.txt", "r", stdin);
    #endif // Irene
    ios::sync_with_stdio(false);

    cin >> n;
    for(int i = 0; i <= n; i++) cin >> a[i];
    if(n == 0){
        cout << (a[0] == 1 ? 1 : -1);
        return 0;
    }
    int f = a[0] == 0 && a[n] > 0;
    b[0] = 1;
    for(int i = 1; i <= n; i++){
        b[i] = min(2 * b[i-1] - a[i], INF);
        f &= b[i] >= 0;
    }
    if(!f){ cout << -1; return 0; }
    b[n] = 0;
    ll ans = a[n];
    for(int i = n - 1; ~i; i--){
        b[i] = min(b[i], b[i+1] + a[i+1]);
        ans += a[i] + b[i];
    }
    cout << ans;
}


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

using namespace std;

#define int long long 
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<int, P> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[] = { 0, 0, 1, -1 };
const int dx[] = { 1, -1, 0, 0 };

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

int X[101], Y[101];

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

    int N, x, y;
    cin >> N;
    cin >> x;
    for(int i = 0; i < x; ++i) {
        int a;
        cin >> a;
        X[a] = 1;
    }
    cin >> y;
    for(int i = 0; i < y; ++i) {
        int a;
        cin >> a;
        Y[a] = 1;
    }
    int z;
    cin >> z;
    int res = 0;
    for(int i = 0; i < z; ++i) {
        int a;
        cin >> a;
        if(!X[a] || Y[a]) ++res;
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 3212
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n; string s;
    cin >> n >> s;
    
    int ans = 0;
    repeat_from_to (i, 1, n-1) {
        string a = s.substr(0, i);
        string b = s.substr(i);
        //cout << a << " " <<  b << " ";
        int tmp = 0;
        for (char c = 'a'; c <= 'z'; ++c) {
            //dump(a.find(c)); dump(b.find(c)); cout << " ";
            if (a.find(c) != string::npos and b.find(c) != string::npos) ++tmp;
        }
        ans = max(ans, tmp);
        //dump(tmp); dump(ans); el;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
s = input()

if s[0] == '0' or s[-1] == '1' or s[:-1] != s[:-1][::-1]:
    print(-1)
    exit(0)

edges = []
head = 0
for idx, i in enumerate(s[:-1]):
    edges.append([head, idx + 1])
    if i == '1':
        head = idx + 1
for i, j in edges:
    print(i + 1, j + 1)


Measured memory_bytes: 21192
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        int m, f, r, sum;
        Scanner scan = new Scanner(System.in);
        while(true){
            m = scan.nextInt();
            f = scan.nextInt();
            r = scan.nextInt();
            sum = m + f;
            if(m == -1 && f == -1 && r == -1) break;
            if(m == -1 || f == -1) System.out.printf("F\n");
            else if(sum >= 80) System.out.printf("A\n");
            else if(sum >= 65) System.out.printf("B\n");
            else if(sum >= 50) System.out.printf("C\n");
            else if(sum >= 30){
                if( r < 50) System.out.printf("D\n");
                else System.out.printf("C\n");
            }
            else if(sum < 30) System.out.printf("F\n");
        }
        scan.close();
    }
}



Measured memory_bytes: 26124
#include<bits/stdc++.h>
using namespace std;
int a[3];
int main()
{
	int k;
	for(int i=0;i<3;i++)
	{
		cin>>a[i];
	}
	cin>>k;
	sort(a,a+3);
	for(int i=0;i<k;i++)
	{
		a[2]*=2;
	}
	cout<<a[0]+a[1]+a[2];
	return 0;
}

Measured memory_bytes: 256
#ABC143-B 累積和でやってみる
N = int(input())
d = list(map(int, input().split()))
acd = []
sumd = 0
for i in range(N):
    sumd += d[i]
    acd.append(sumd)
ans = 0
for i in range(N):
    ans += d[i] * (acd[N-1] - acd[i])
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
using namespace std;
int main(void){
    int N;
    scanf("%d",&N);
    int p[N];
    for(int i=0; i<N; i++){
        scanf("%d",&p[i]);
    }
    
    int value;
    int pls_i;
    int ord = 0;
    for(int i=0; i<N; i++){
        if(p[i] > ord){
            value = p[i];
            pls_i = i;
            ord = value;
        }
    }
    value = value / 2;
    
    int sum = 0;
    for(int i=0; i<N; i++){
        if(i == pls_i){
            continue;
        }
        sum += p[i];
    }
    printf("%d\n",sum+value);
    
}


Measured memory_bytes: 128
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;

typedef
tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
}

void solve() {
    int n;
    ll k;
    cin >> n >> k;
    vll a(n);
    forn(i, n) cin >> a[i];
    ll l = 1, r = 1000000001;
    while (l < r){
        int m = (l + r) >> 1;
        ll cnt = 0;
        forn(i, n) cnt += (a[i] - 1) / m;
        if (cnt > k) l = m + 1; else r = m;
    }
    cout << l << '\n';
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 4764
#include <stdio.h>
#include <ctype.h>
int main(void) {
	int cnt[26]={},i;
	char a[27]="zyxwvutsrqponmlkjihgfedcba",c;
	while(scanf("%c",&c)!=EOF){
		if(!isalpha(c)){continue;}
		if(islower(c)){
			i=c-'a';
		}else if(isupper(c)){
			i=c-'A';
		}
		cnt[i]++;
	}
	for(i=26;i>0;i--){
		printf("%c : %d\n",a[i-1],cnt[26-i]);
	}
	return 0;
}

Measured memory_bytes: 544
#include <bits/stdc++.h>
#define mp make_pair

using namespace std;
typedef pair<int,int> p;
int n,k,l;
int a[200001];
int b[200001];
map <p,int> m;

void init(int n) {
  for(int i = 0; i < n; i++) {
    a[i] = i;
    b[i] = i;
  }
}

int Find(int x,bool ok) {
  if(ok) return a[x] == x ? x : a[x] = Find(a[x],ok);
  else return b[x] == x ? x : b[x] = Find(b[x],ok);
}

void Union(int x, int y, bool ok) {
  x = Find(x,ok);
  y = Find(y,ok);
  if(ok) {
    if(Find(x,ok) == Find(y,ok)) return;
    a[x] = y;
  }
  else {
    if(Find(b[x],ok) == Find(b[y],ok)) return;
    b[x] = y;
  }
}
  
  
int main() {
  cin >> n >> k >> l;
    init(n);
  for(int i = 0; i < k; i++) {
    int p,q;
       cin >> p >> q;
     p--; q--;
    Union(p,q,true);
  }


  
  for(int i = 0; i < l; i++) {
    int r,s;
       cin >> r >> s;
     r--; s--;
    Union(r,s,false);
  }

 
  for(int i = 0; i < n; i++) {
    m[mp(Find(i,true),Find(i,false))]++;
   }

  for(int i = 0; i < n; i++) {
    cout << m[mp(Find(i,true),Find(i,false))] <<endl;
  }
}
  
  


Measured memory_bytes: 13568
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#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 srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int q;
    cin >> q;
    rep(i,q){
        ll a,b;
        cin >> a >> b;
        if(a == 1 && b == 1){
            cout << "0\n";
            continue;
        }
        ll mul = a * b;
        ll sub = 0;
        ll l = 1, r = ceil(sqrt(mul));
        while(r-l>1){
            ll mid = (l+r)/2;
            if(mid*mid <= mul-1){
                l = mid;
            }else{
                r = mid;
            }
        }
        if(a <= l || b <= l){
            sub++;
        }
        if(l == (mul-1)/l){
            sub++;
        }
        cout << 2*l-sub << "\n";
    }
    return 0;
}


Measured memory_bytes: 256