akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
  int n,m,i,j,k,mi,mj,mk,s,e;
  double min;
  while(scanf("%d %d",&n,&m),n||m){
    int d[31][31]={0};
    int l[31][31]={0};
    scanf("%d %d",&mi,&e);
    while(m--){
      scanf("%d %d %d %d",&i,&j,&k,&s);
      d[i][j]=d[j][i]=k;
      l[i][j]=l[j][i]=s;
    }
    double c[31][31][31]={0};
    int f[31][31][31]={0};//printf("a\n");
    int ff[31][31]={0};
    mj=mk=0;
    while(mi-e||mk-1){
      f[mi][mj][mk]=1;
      ff[mi][mk]++;
      for(i=1;i<=n;i++){
	if(i==mj||d[mi][i]==0)continue;
	for(j=mk-1;j<mk+2;j++){
	  if(j<1||l[mi][i]<j||f[i][mi][j]||ff[i][j]>1)continue;
	  if(c[i][mi][j]==0||c[i][mi][j]>c[mi][mj][mk]+1.0*d[mi][i]/j){
	    c[i][mi][j]=c[mi][mj][mk]+1.0*d[i][mi]/j;
	  }
	}
      }
      min=100000000;
      for(i=1;i<=n;i++){
	for(j=1;j<=n;j++){
	  for(k=1;k<=30;k++){
	    if(f[i][j][k]||ff[i][k]>1||c[i][j][k]==0)continue;
	    if(min>c[i][j][k])min=c[mi=i][mj=j][mk=k];
	  }
	}
      }
      if(min==100000000)break;
    }
    if(min-100000000)printf("%f\n",min);
    else             printf("unreachable\n");
  }
  return 0;
}

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

typedef vector<pair<double, double> > VP;
typedef pair<double, double> P;


VP sub(double ax, double ay, double bx, double by) {
    VP ret;
    ret.emplace_back(make_pair((ax * 2 + bx) / 3, (ay * 2 + by) / 3));
    ret.emplace_back(make_pair((ax + bx) / 2 - (by - ay) / (2 * sqrt(3)), (ay + by) / 2 + (bx - ax) / (2 * sqrt(3))));
    ret.emplace_back(make_pair((ax + bx * 2) / 3, (ay + by * 2) / 3));
    return ret;
}


VP f(int n, VP v) {
    if (n == 0) return v;
    VP next;
    next.emplace_back(v[0]);
    for (int i = 0; i < v.size() - 1; ++i) {
        P a = v[i], b = v[i + 1];
        for (auto p : sub(a.first, a.second, b.first, b.second)) {
            next.emplace_back(p);
        }
        next.emplace_back(b);
    }
    return f(n - 1, next);
}

int main() {
    int n;
    cin >> n;
    VP a;
    a.emplace_back(make_pair(0.0, 0.0));
    a.emplace_back(make_pair(100.0, 0.0));
    a = f(n, a);
    for (P p : a) {
        printf("%.9lf %.9lf\n", p.first, p.second);
    }
    return 0;
}

Measured memory_bytes: 3264
#include<bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int count = 0;
  for(int i = 0;i < s.length()/2;i++) {
      if(s[i] != s[s.length()-i-1]) {
          count++;
      }
  }
  cout << count << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<long long> P(N);
    for(int i = 0; i < N; i++) cin >> P[i];
    vector<int> ind(N);
    for(int i = 0; i < N; i++) ind[i] = i;
    sort(ind.begin(), ind.end(), [&](int x, int y){
        return P[x] > P[y];
    });
    set<int> s;
    long long ans = 0;
    s.insert(-1);
    s.insert(N);
    s.insert(ind[0]);
    for(int i = 1; i < N; i++){
        auto ite = s.upper_bound(ind[i]);
        long long r = ind[i], l = ind[i];
        auto ite2 = ite, ite3 = ite, ite4 = ite;
        long long res = 0;
        if(*ite == N){
            r = N - ind[i];
            ite--;
            long long temp = *ite;
            ite--;
            l = temp - *ite;
            res += l * r;
        }
        else if(*(--ite4) == -1){
            l = ind[i] + 1;
            long long temp = *ite2;
            ite2++;
            r = *ite2 - temp;
            res += r * l;
        }
        else{
            long long temp1 = *ite, temp2 = *(++ite2), temp3 = *(--ite3);
            res += (ind[i] - temp3) * (temp2 - temp1);
            if(temp3 != -1){
                long long temp4 = *(--ite3);
                res += (temp3 - temp4) * (temp1 - ind[i]);
            }
        }
        s.insert(ind[i]);
        ans += res * P[ind[i]];
    }
    cout << ans << endl;
}

Measured memory_bytes: 8992
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());

        for (int i = 0; i < n; i++) {
            String[] input = br.readLine().split(" ");

            double xa = Double.parseDouble(input[0]);
            double ya = Double.parseDouble(input[1]);
            double ra = Double.parseDouble(input[2]);
            double xb = Double.parseDouble(input[3]);
            double yb = Double.parseDouble(input[4]);
            double rb = Double.parseDouble(input[5]);

            double distance = Math.sqrt(Math.pow(xb - xa, 2.0) + Math.pow(yb - ya, 2.0));

            if (distance > ra + rb) {
                System.out.println("0");
            } else if (distance < ra - rb) {
                System.out.println("2");
            } else if (distance < rb - ra) {
                System.out.println("-2");
            } else {
                System.out.println("1");
            }
        }
    }
}


Measured memory_bytes: 24300
import math
import numpy as np

N, D = map(int, input().split())
xss = np.array([[int(s) for s in input().split()] for _ in range(N)])


cnt = 0
for i in range(N):
    for j in range(i):
        diff2 = ((xss[i] - xss[j])**2).sum()
        d = int(np.sqrt(diff2))
        if d * d == diff2: 
            cnt += 1

print(cnt)

Measured memory_bytes: 21276
package main

import (
	"fmt"
	"os"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	nums := scanIntSlice(n)

	known := map[int]struct{}{}
	for _, n := range nums {
		if _, ok := known[n]; ok {
			fmt.Println("NO")
			os.Exit(0)
		}
		known[n] = struct{}{}
	}
	fmt.Println("YES")
}

func scanIntSlice(size int) []int {
	input := []int{}
	for i := 0; i < size; i++ {
		var in int
		fmt.Scanf("%d", &in)
		input = append(input, in)
	}
	return input
}


Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};

const int N=303,B=40;
int a[N];
int32_t main(){
    int n;
    cin>>n;
    forn(i,n)cin>>a[i];
    int s=a[0]+a[1];
    int x=0;
    for(int i=2;i<n;++i)x^=a[i];
    int u=(s-x)/2;
    if(u+u!=s-x||u>a[0]||u<0||(x&u)){
        cout<<"-1\n";
        return 0;
    }
    int ans=u;
    for(int i=B;i>=0;--i){
        if(x>>i&1){
            if(ans+(1ll<<i)<a[0]){
                ans+=(1ll<<i);
            }
        }
    }
    if(!ans)cout<<"-1\n";
    else cout<<a[0]-ans<<'\n';

    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,w;
    cin>>n>>w;
    ll arr[n+1][2];
    for(ll i=1;i<=n;i++)cin>>arr[i][0]>>arr[i][1];
    ll dp[n+1][w+1];
    for(ll i=0;i<=n;i++)
    {
        for(ll j=0;j<=w;j++)
        {
        if(i==0||j==0)dp[i][j]=0;
        else
        {
            if(arr[i][0]>j)dp[i][j]=dp[i-1][j];
            else
            {
                dp[i][j]=max(dp[i-1][j-arr[i][0]]+arr[i][1],dp[i-1][j]);
            }
        }
        }
    }
    cout<<dp[n][w]<<endl;
}

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

int main() {
  int n,p;
  
  while(1) {
  cin >> n >> p;
  if(n == 0 && p == 0) break;
  int a[51]={};

  int ima = 0;
  int stn=p;
  while(1) {
 
    if(stn > 0) {
    a[ima%n] += 1;
    stn--;
    if(a[ima%n] == p) break;
    }
    else if(stn == 0){
      stn+=a[ima%n];
      a[ima%n] = 0;
    }
    ima++;
  }

  cout << (ima)%n<<endl;
  }

  return 0;

}

Measured memory_bytes: 1160
use std::cmp::Ordering;

fn main() {
    let _n = read_line();

    let mut a = read_numbers();
    let b = read_numbers();
    let mut c = read_numbers();

    a.sort();
    c.sort();

    let mut result = 0;

    let a_len = a.len();

    for b in b {
        let lower = a_len - a[upper_bound(&a, b)..].len();
        let upper = c[lower_bound(&c, b)..].len();

        result += lower * upper;
    }

    println!("{}", result);
}

fn lower_bound(iter: &Vec<usize>, key: usize) -> usize {
    let mut low = 0;
    let mut high = iter.len();

    while low < high {
        let mid = (low + high) / 2;

        match iter[mid].cmp(&key) {
            Ordering::Less | Ordering::Equal => low = mid + 1,
            Ordering::Greater => high = mid,
        }
    }

    low
}

fn upper_bound(iter: &Vec<usize>, key: usize) -> usize {
    let mut low = 0;
    let mut high = iter.len();

    while low < high {
        let mid = (low + high) / 2;

        match iter[mid].cmp(&key) {
            Ordering::Less => low = mid + 1,
            Ordering::Greater | Ordering::Equal => high = mid,
        }
    }

    low
}

fn read_line() -> String {
    let stdin = std::io::stdin();

    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();

    buf
}

fn read_numbers() -> Vec<usize> {
    read_line()
        .trim()
        .split(" ")
        .map(|c| c.parse::<usize>().unwrap())
        .collect()
}


Measured memory_bytes: 13560
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.next());
        int[][] n = new int[N][2];
        for (int i = 0; i < N; i++) {
            n[i][0] = Integer.parseInt(scanner.next());
            n[i][1] = i;
        }
        Arrays.sort(n, Comparator.comparingInt(x -> x[0]));

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < N; i++) {
            sb.append(n[i][1] + 1);
            sb.append(' ');
        }
        System.out.println(sb.toString());
    }

}


Measured memory_bytes: 49140
import java.util.*;
import  java.lang.*;



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

        String a = sc.nextLine();
        String b = sc.nextLine();

        List<Character> listA = new ArrayList<>();
        List<Character> listB = new ArrayList<>();

        for (int i = 0; i < a.length(); i++) {
            listA.add(a.charAt(i));
        }

        for (int i = 0; i < b.length(); i++) {
            listB.add(b.charAt(i));
        }

        Collections.sort(listA);
        Collections.sort(listB, Collections.reverseOrder());

        String aSorted = "";
        String bSorted = "";

        for (int i = 0; i < listA.size();i++) {
            aSorted += listA.get(i);
        }

        for (int i = 0; i < listB.size();i++) {
            bSorted += listB.get(i);
        }

        System.out.println(aSorted.compareTo(bSorted) < 0 ? "Yes" : "No");

    }
}

Measured memory_bytes: 22996
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int n = sc.nextInt();
		int taro = 0; int hanako = 0;
		for (int i=0; i<n; i++) {
			String t = sc.next(); String h = sc.next();
			if (t.compareTo(h) < 0) hanako += 3;
			else if (t.compareTo(h) > 0) taro += 3;
			else {
				taro++; hanako++;
			}
		}
		System.out.println(taro+" "+hanako);
		
	}
}


Measured memory_bytes: 29644
#include<iostream>
#include <string>
#include<vector>
typedef long long ll;

using namespace std;
int main()
{
	int n;
	cin >> n;
	int kotae;
	if (n % 2) {
		kotae = n * 2;
	}
	else {
		kotae = n;
	}
	cout << kotae;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i,j;
  int adj[100][100];
  int n,u,k,v;

  for(i=0;i<100;i++){for(j=0;j<100;j++){adj[i][j]=0;}}

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      adj[u][v]=1;
    }
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j>0){printf(" ");}
      printf("%d",adj[i][j]);
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2088
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<cstdlib>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#include<deque>
#define lmid l,mid,rt<<1
#define rmid mid+1,r,rt<<1|1
using namespace std;
int s[2][100],d[2][2]={0,1,1,0};
int sum=0,n;
void dfs(int x,int y,int z)
{
     if(x==1&&y==n-1)
     {
          sum=max(sum,z);
          return ;
     }
     for(int i=0;i<2;i++)
     {
          int xx=x+d[i][0];
          int yy=y+d[i][1];
          if(xx<2&&yy<n)
               dfs(xx,yy,z+s[xx][yy]);
     }
}
int main()
{
     scanf("%d",&n);
     for(int i=0;i<2;i++)
          for(int j=0;j<n;j++)
          scanf("%d",&s[i][j]);
     dfs(0,0,s[0][0]);
     printf("%d\n",sum);
}


Measured memory_bytes: 256
a = int(input())
ar = list(map(int,input().split(" ")))
br = list(map(int,input().split(" ")))
count = 0
for i in range(a):
    if ar[i] <= br[i]:
        count += ar[i]
        ar[i] == 0
        br[i] -= ar[i]
        if ar[i+1] <= br[i]:
            count += ar[i+1]
            ar[i+1] = 0
        else:
            ar[i+1] -= br[i]
            count += br[i]
    else:
        ar[i] -= br[i]
        count += br[i]
print(count)


Measured memory_bytes: 18624
#include <iostream>

using namespace std;

unsigned long long MinAux(unsigned long long A, unsigned long long B){
    if(A>=B) return B;
    return A;
}

unsigned long long Min(unsigned long long A, unsigned long long B, unsigned long long C){
    return MinAux(A,MinAux(B,C));
}

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

    if((A%2==0)||(B%2==0)||(C%2==0)) result = 0;
    else {
        result = Min(B*C, A*B, A*C);
    }
    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]){
        String S=sc.next(),T=sc.next(),res="Yes";
        HashMap<Integer,Integer> s=new HashMap<>(),t=new HashMap<>();
        for(int i=0;i<S.length();i++){
            if(!s.containsKey(((int)S.charAt(i)))){
                s.put((int)S.charAt(i),(int)T.charAt(i));
            }
            else if((int)T.charAt(i)!=s.get((int)S.charAt(i))){
                res="No";
                break;
            }
            if(!t.containsKey(((int)T.charAt(i)))){
                t.put((int)T.charAt(i),(int)S.charAt(i));
            }
            else if((int)S.charAt(i)!=t.get((int)T.charAt(i))){
                res="No";
                break;
            }
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 42136
#include <iostream>
#include <vector>
#include <stack>

#define MAX 101

using namespace std;

int visited[MAX],d[MAX],f[MAX],called[MAX];
int tt=0;
vector<int> G[MAX];
stack<int> S;

int getNext(int u){
  if(called[u]>=G[u].size()) return -1;
  else{
    int x=G[u][called[u]];
    called[u]++;
    return x;
  }
}


void dfs(int u){
  S.push(u);
  visited[u]=1;
  d[u]=++tt;
  while(S.empty()==false){
    int x=S.top();
    int v=getNext(x);
    if(v!=-1){
      if(visited[v]==0){
        visited[v]=1;
        d[v]=++tt;
        S.push(v);
      }
    }else{
      S.pop();
      visited[x]=1;
      f[x]=++tt;
    }
  }
}

int main(){
  int n; cin >> n;
  for(int i=1;i<=n;i++){
    visited[i]=0;
    called[i]=0;
  }
  for(int i=0;i<n;i++){
    int u,k; cin >> u >> k;
    for(int i=0;i<k;i++){
      int v; cin >> v;
      G[u].push_back(v);
    }
  }
  for(int i=1;i<=n;i++){
    if(visited[i]==0){
      dfs(i);
    }
  }
  for(int i=1;i<=n;i++){
    cout << i << " " << d[i] << " " << f[i] << endl;
  }
}

Measured memory_bytes: 3140
#include <iostream>
#include <set>
using namespace std;
int main(void){
  int n;
  while(cin>>n,n){
    int turn=0,c=0;
    set<int> taro,hanako;
    for(int i=0,a;i<n;++i){cin>>a;taro.insert(a);}
    for(int i=1;i<=2*n;++i)if(taro.find(i)==taro.end()) hanako.insert(i);
    for(int i=1;!(taro.empty()||hanako.empty());++i){
      if(turn==0&&taro.find(i)!=taro.end()){
        if(i>c){c=i;taro.erase(taro.find(i));i=0;turn=1;continue;}
      }else if(turn==1&&hanako.find(i)!=hanako.end()){
        if(i>c){c=i;hanako.erase(hanako.find(i));i=0;turn=0;continue;}
      }
      if(i==2*n){
        turn=(turn)?0:1;
        c=0;
        i=0;
      }
    }
    cout<<hanako.size()<<"\n"<<taro.size()<<endl;
  }
  return 0;
}

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

signed main(void)
{
	int n, k;
	cin >> n >> k;
	ll a[n];
	rep(i, n) cin >> a[i];
	ll tmp = a[0];
	for (int i = k; i < n; i++)
	{
		if (tmp < a[i])
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
		tmp = a[i - k + 1];
	}
	return 0;
}


Measured memory_bytes: 5128
n=int(input())
li=[]
for i in range(n):
  a,b=map(int,input().split())
  li.append([a,b,a+b])
lst=sorted(li,key=lambda x:x[2],reverse=True)

i=0
ans=0
try:
  while True:
    if i%2==0:ans+=lst[i][0]
    else:ans-=lst[i][1]
    i+=1
except:
  pass
    
    
print(ans)

Measured memory_bytes: 25228
N = int(input())

xy = [[0,0] for i in range(N)]

for i in range(N):
    tmp_x, tmp_y = map(int, input().split())
    xy[i][0] = tmp_x
    xy[i][1] = tmp_y

#x座標でソート
xy = sorted(xy, key = lambda x: x[0])



ans = 9999
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        else:
            p = xy[i][0] - xy[j][0]
            q = xy[i][1] - xy[j][1]
        tmp = 0
        for x in range(N):
            for y in range(N):
                if x == y:
                    continue
                else:
                    if  xy[x][0] - xy[y][0] == p and xy[x][1] - xy[y][1] == q:
                        tmp += 1
        ans = min(ans, N - tmp)
if N == 1:
    print(1)
else:
    print(ans)

Measured memory_bytes: 3064
import itertools as it
def LI(): return list(map(int, input().split()))

def explain(n, k):
    l = (n-1) * (n-2) // 2 - k
    print(n-1 + l) # M

    # loop
    for i in range(2, n+1):
        print(1, i)

    # lessen 2 distance pairs
    count = 0
    for i, j in it.combinations(range(2, n+1), 2):
        if count >= l:
            break
        print(i, j)
        count += 1


n, k = LI()

if k > (n-1) * (n-2) // 2:
    print(-1)
else:
    explain(n, k)


Measured memory_bytes: 3608
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    
    /////////////////////
    // Write code below /
    /////////////////////
    int firstNumber, secondNumber;
    cin >> firstNumber >> secondNumber;

    int product = firstNumber * secondNumber;
    if (product % 2 == 1) {
        cout << "Odd" << endl;
    } else {
        cout << "Even" << endl;
    }
    
    return 0;
}


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

using namespace std;

int main()
{
	int a, b, c, d, e, f;
	
	cin >> a >> b >> c;
	
	cout << min(a, min(b, c)) << " " << (min(a, max(b, c)), max(min(b, max(a, c)), min(c, max(a, b))))  << " " << max(a, max(b, c)) << endl;
	
    return 0;
}

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

typedef long long ll;
typedef int64_t in;
using namespace std;
#define INF 1000000007



int main() {
    ll n;
    cin >> n;
    vector<ll> x(n), y(n);
    vector<vector<ll>> xdis(n, vector<ll> (n, 0));
    vector<vector<ll>> ydis(n, vector<ll> (n, 0));
    for(ll i=0; i<n; i++){
        cin >> x[i] >> y[i];
    }
    if(n == 1){
        cout << "1" << endl;
        return 0;
    }

    for(ll i=0; i<n; i++){
        for(ll j=0; j<n; j++){
            if(i != j){
                xdis[i][j] = x[j] - x[i];
                ydis[i][j] = y[j] - y[i];
            }
        }
    }
    
    vector<vector<ll>> count(n, vector<ll> (n, 0));

    for(ll i=0; i<n; i++){
        for(ll j=0; j<n; j++){
            for(ll k=0; k<n; k++){
                for(ll l=0; l<n; l++){
                    if(i==j || k==l) continue;
                    if(i==k || j==l) continue;
                    if(xdis[i][j] == xdis[k][l] && ydis[i][j] == ydis[k][l]){
                        count[i][j]++;
                        //count[k][l]++;
                    }
                }
            }
        }
    }
    ll M=0;
    for(ll i=0; i<n; i++){
        for(ll j=0; j<n; j++){
            M = max(M, count[i][j]);
            //cout << count[i][j] << endl;
        }
    }
    M++;
    ll ans = n - M;
    //cout << M << endl;
    cout << ans << endl;
}

Measured memory_bytes: 256
main(){double a,b,c,d,e,f,g,h,i,j,k,l,x,y,t,u;while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=-1){j=g=a*d;k=e*a;h=d*b;i=c*d;l=f*a;t=h-k;u=i-l;y=u/t;h=k=b*e;g=e*a;i=c*e;j=d*b;l=f*b;t=g-j;u=i-l;x=u/t;if(x==-0)x=0;if(y==-0)y=0;printf("%.3lf %.3lf\n",x,y);}return 0;}

Measured memory_bytes: 0
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
    string s1,s2,s3;
    string a,b,c;
    cin >> s1 >> s2 >> s3;
    s1[0]-=32;
    s2[0]-=32;
    s3[0]-=32;
    cout << s1[0] << s2[0] << s3[0] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

vector<int> A;

const int BITS = 2000 * 1000 + 3000;

bitset<BITS> dp, current, tmp;

int main() {
	int N;
	scanf("%d", &N);
	int x, sum = 0;
	A.clear();
	FOR (i, N) {
		scanf("%d", &x);
		A.pb(x);
		sum += x;
	}
	sort(all(A));
	dp.reset();
	dp.set(0);
	FOR (i, A.sz) {
		tmp = dp;
		tmp <<= A[i];
		dp |= tmp;
	}
	FOR (i, BITS)
		if (2 * i >= sum && dp.test(i)) {
			printf("%d\n", i);
			break;
		}
	return 0;
}

Measured memory_bytes: 768
H, W = map(int, input().split())
Slist = list()
HWlist =list()

for i in range(0,H):
    Slist.append(str(input()))
    HWlist.append(list(Slist[i]))

for i in range(0,H):
	for j in range(0,W):
		frag = 0
		if HWlist[i][j] == "#":
			if i-1 >=0:
				if HWlist[i-1][j]=="#":
					frag = frag +1
			if i + 1 < H:
				if HWlist[i + 1][j] == "#":
					frag = frag + 1
			if j - 1 >= 0:
				if HWlist[i][j-1] == "#":
					frag = frag + 1
			if j + 1 < W:
				if HWlist[i][j+1] == "#":
					frag = frag + 1
			if frag == 0:
				print("No")
				exit()

print("Yes")

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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
//int in() { int x; scanf("%d", &x); return x; }
//ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

int main(void){

	int n, l;
	cin >> n >> l;

	int ans = 0, temp = 0, fval = 0;
	if(n+l-1 < 0){
		fval = n+l-1;
	} else {
		fval = 1+l-1;
	}

	bool zero = 0;
	FOR(i, n){
		temp = i+1+l-1;
		if(temp == 0){
			zero = 1;
		}

		ans += temp;
	}

	if(zero == 1){
		cout << ans;
	} else {
		cout << (ans-fval);
	}

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include<set>
#include<vector>
#define MAX 5000
using namespace std;
int main(void) {
    string s;
    int k;
    set<string> st;
    cin >> s >> k;
    
    for(int i=0; i<s.size(); i++) {
        string tmp;
        for(int j=0; j<5 && j+i<s.size(); j++) {
            tmp += s[i+j];
            st.insert(tmp);
        }
    }
    vector<string>vec = vector<string>(st.begin(), st.end());
    cout << vec[k-1] << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(ll i=0;i<N;++i)
typedef long long int ll;
ll INF = 1LL<<60;

int main(){
    int n; cin >> n;
    ll ans = 0;
    
    for(int i=n;i>0;i--){
        int cnt = 0;
        int tmp = i;
        while(tmp){
            tmp /= 10;
            cnt ++;
        }
        if(cnt%2) ans ++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int ganpon = 100000;/* 元本 */
	int n;
	double riritu = 0.05; /* 利率 */
	int i;

	scanf("%d", &n);

	for(i = 0; i < n; i++) {
		if((int)(ganpon * (1.0 + riritu)) % 1000 == 0)
			ganpon = ganpon * (1.0 + riritu);
		else
			ganpon = ((int)(ganpon * (1.0 + riritu)) / 1000) * 1000 + 1000;
	}

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

	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned ui;
typedef unsigned long long ul;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef pair<bool, bool> pbb;
typedef vector<int> vi;
#define pb push_back
#define fi first
#define se second
#define mid ((l + r) >> 1)
#define ls (i << 1)
#define rs (i << 1 | 1)
#define enum(i, j, k) for(int i = j; i <= k; i ++)
#define open(i, j, k) for(int i = j; i <  k; i ++)
#define dec(i, j, k)  for(int i = j; i >= k; i --)
#define ae(x) for(node *p = h[x]; p; p = p->nxt)
template <class T> bool chkmin(T &x, T y)
{ return y < x ? x = y, true : false; }
template <class T> bool chkmax(T &x, T y)
{ return y > x ? x = y, true : false; }
int _()
{
	int ret = 0; bool f = true; char ch = getchar();
	while(!isdigit(ch)) { if(ch == '-') f = false; ch = getchar(); }
	do { ret = ret * 10 + ch - '0'; ch = getchar(); } while(isdigit(ch));
	return f ? ret : -ret;
}
void _(int x)
{
	if(x < 10) { putchar(x + '0'); return ; }
	_(x / 10); putchar(x % 10 + '0');
}
void __init()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(16);
	srand(time(0) ^ ui(ul(new char)));
}
/* default code ends here */

int main()
{
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	__init();
	int n;
	string a, b, c;
	cin >> n >> a >> b >> c;
	int ans = 0;
	open(i, 0, n)
	{
		ans += (a[i] == b[i] && b[i] == c[i] ? 0 : (a[i] == b[i] || b[i] == c[i] || c[i] == a[i] ? 1 : 2));
	}
	cout << ans << '\n';
	return 0;
}

















































Measured memory_bytes: 256
#[allow(dead_code)]
fn main() {
    let (a, b) = (i::s(), i::s());
    if a.len() != b.len() {
        println!("{}", if a.len() > b.len() { "GREATER" } else { "LESS" });
        return;
    }

    let zip: Vec<_> = a.iter().cloned().zip(b).collect();
    for (a, b) in zip {
        if a == b {
            continue;
        }
        println!("{}", if a > b { "GREATER" } else { "LESS" });
        return;
    }
    println!("{}", "EQUAL");
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }
    pub fn str() -> String {
        read()
    }
    pub fn s() -> Vec<char> {
        str().chars().collect()
    }
    pub fn i() -> i64 {
        read()
    }
    pub fn u() -> usize {
        read()
    }
    pub fn u2() -> (usize, usize) {
        (read(), read())
    }
    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }
    pub fn u4() -> (usize, usize, usize, usize) {
        (read(), read(), read(), read())
    }
    pub fn u5() -> (usize, usize, usize, usize, usize) {
        (read(), read(), read(), read(), read())
    }
    pub fn u6() -> (usize, usize, usize, usize, usize, usize) {
        (read(), read(), read(), read(), read(), read())
    }
    pub fn f() -> f64 {
        read()
    }
    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }
    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }
    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }
    pub fn iv3(n: usize) -> Vec<(i64, i64, i64)> {
        (0..n).map(|_| iv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }
    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }
    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }
    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }
    pub fn uv4(n: usize) -> Vec<(usize, usize, usize, usize)> {
        (0..n)
            .map(|_| uv(4))
            .map(|a| (a[0], a[1], a[2], a[3]))
            .collect()
    }
    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }
    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 1e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;

ll n,a[N],q,b,c,sum;
unordered_map<int,int> num;

int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  cin>>n;
  for(int i = 1;i <= n;i++) {cin>>a[i];num[a[i]]++;sum+=a[i];}
  cin>>q;
  while(q--){
    cin>>b>>c;
    sum -= b*num[b];
    sum += c*num[b];
    num[c] += num[b];
    num[b]=0;
    cout<<sum<<endl;
  }
  return 0;
}


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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

int gcd(int x, int y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int a, b;
	cin >> a >> b;
	if (a % 2 && b % 2) {
		cout << "Odd\n";
	}
	else {
		cout << "Even\n";
	}
}

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


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.buffer.readline
    H, W = (int(i) for i in input().split())
    c = [[int(i) for i in input().split()] for j in range(10)]
    A = [[int(i) for i in input().split()] for j in range(H)]
    from scipy.sparse.csgraph import dijkstra
    from scipy.sparse import csr_matrix
    d = dijkstra(csr_matrix(c))
    ans = 0
    for h in range(H):
        for w in range(W):
            cur = A[h][w]
            if cur == -1:
                continue
            ans += d[cur][1]
    print(int(ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 14092
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass
{
    static void Main()
    {
        int N = int.Parse(ReadLine());
        for (int i = 0; i < 100; i++)
        {
            for (int j = 0; j < 100; j++)
            {
                if (i * 4 + j * 7 == N)
                {
                    WriteLine("Yes");
                    return;
                }
                
            }
        }
        WriteLine("No");
    }
}


Measured memory_bytes: 27500
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,i;
	double a=0,c;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		if(i%2==1)
		{
			a+=1;
		}
	}
	c=a/n;
	cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
						
#define fast_cin() ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define endl '\n'
#define int long long

const int N = 1e5, mod = 1e9 + 7;

int cnt[N + 1];

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

int mod_inv(int x) {
	return binpow(x, mod - 2);
}
				
int32_t main() {
	fast_cin();  
	int n, k;
	cin >> n >> k;
	for (int gd = k; gd >= 1; gd--) {
		int total = binpow(k / gd, n);
		int less = 0;
		for (int j = 2 * gd; j <= k; j += gd) {
			less +=  cnt[j];
			less %= mod;
		}
		cnt[gd] = total - less;
		cnt[gd] += mod;
		cnt[gd] %= mod;
	}
	int ans = 0;
	for (int gd = 1; gd <= k; gd++) {
		ans += gd * cnt[gd];
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4364
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};

int main() {
    string s; cin >> s;
    int c = 0;
    rep(i, s.size()) { //01
        if (i % 2 == 0 && s[i] == '1') c++;
        if (i % 2 != 0 && s[i] == '0') c++;
    }
    int c2 = 0;
    rep(i, s.size()) {
        if (i % 2 == 0 && s[i] == '0') c2++;
        if (i % 2 != 0 && s[i] == '1') c2++;
    
    }
    cout << min(c, c2) << endl;
}


Measured memory_bytes: 512
const main: number = (input) => {
  input = input.split(" ");
  const A: number[] = parseInt(input[0], 10);
  const B: number[] = parseInt(input[1], 10);
  const C: number[] = parseInt(input[2], 10);
  
  if (A + B + C === 17) {
    console.log('YES');
  } else {
    console.log('NO');
  }
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define maxn 500
using namespace std;
int n,m,iomap[maxn][maxn],res=0;
vector<pair<int,int> > s,e;
int main()
{
	cin>>n>>m;
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			cin>>iomap[i][j];
	for(int i=0;i<n;i++)
		for(int j=0;j<m-1;j++)
		{
			if(iomap[i][j]%2==0)
				continue;
			--iomap[i][j];
			++iomap[i][j+1];
			s.push_back(make_pair(i+1,j+1));
			e.push_back(make_pair(i+1,j+2));
			++res;
		}
	int j=m-1;
	for(int i=0;i<n-1;i++)
	{
		if(iomap[i][j]%2==0)
			continue;
		--iomap[i][j];
		++iomap[i+1][j];
		s.push_back(make_pair(i+1,j+1));
		e.push_back(make_pair(i+2,j+1));
		++res;
	}
	cout<<res<<endl;
	for(int i=0;i<s.size();i++)
       cout<<s[i].first<<' '<<s[i].second<<' '<<e[i].first<<' '<<e[i].second<<endl;
	return 0;
}

Measured memory_bytes: 5228
A, B = gets.chomp.split
cnt = 0
(A[0..1].to_i..B[0..1].to_i).each do |i|
    j = i.to_s.reverse.to_i
    (0..9).each do |k|
        cnt += 1 if (i * 1000 + k * 100 + j).between?(A.to_i, B.to_i)
    end
end
puts cnt

Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <string>
#include <set>
#include <iomanip>
#include <unordered_map>
#include <cmath>
#define int long long
#define pii pair<int, int>
typedef long long ll;
using namespace std;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
}

signed main() {
	fast();
	string s;
	cin >> s;
	int n = s.size();
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			string a = s.substr(0, i + 1) + s.substr(j, n - j);
			//cout << a << '\n';
			if (a == "keyence") {
				cout << "YES";
				return 0;
			}
		}
	}
	for (int j = 0; j <= n - 7; j++) {
		if (s.substr(j, 7) == "keyence") {
			cout << "YES";
			return 0;
		}
	} 
	cout << "NO";
	return 0;
}

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

using namespace std;

int main(){
    
    double r;
    
    cin>>r;
    double pi=3.141592653589;
    
    double are=pi*r*r;
    double circ=2*pi*r;
    
  printf("%f %f\n", are, circ);
    
    
}


Measured memory_bytes: 3292
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <queue>
using namespace std;
//________
#define pb push_back
#define fi first
#define se second
#define mkp make_pair
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define reps(i,f,n) for(int i=(f); i<=(n); ++i)
#define err(...) fprintf(stderr, __VA_ARGS__ )
#define show(x) cerr << #x << ':' << (x) << endl
#define outl(x) cout << (x) << '\n'
#define FAST() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, B b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, B b){return b<a ? a=b,1 : 0;}
inline bool inside(int y, int x, int H, int W){return(y>=0 && x>=0 && y<H && x<W);}
const int dx[] = {1, 0, -1, 0,  1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1,  -1, 1, 1, -1};
#define Size 1000111
#define INF  0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define NIL -1
//________


signed main()
{
   FAST();
   int a,b;
   cin >> a >> b;
   string s;
   cin >> s;

   bool f = true;

   rep(i, s.length()){
      if(i == a)f = s[i] == '-';
      else if(s[i] < '0' || s[i] > '9'){
         f = false;
         break;
      }
   }

   outl( f ? "Yes" : "No" );
}



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

int main(){
  int n;
  cin >> n;
  int ans=0;
  for(int i=1;i<=n;i+=2){
    int count=0;
    for(int j=1;j<=i;++j){
      if(i%j==0) count++;
    }
    if(count==8) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
def digit_sum(n, sum=0)
    s = sum + n % 10
    i = n.div(10)
    i > 0 ? digit_sum(i, s) : s
end
N = gets.to_i
min = 100
1.upto(N.div(2)) do |a|
    b = N - a
    min = [min, digit_sum(a) + digit_sum(b)].min
end
puts min

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>

const long long MOD = 1000000007;

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main(){
  int64_t x;
  bool ck=false;
  cin >> x;
  vector<int64_t> f=divisor(x);
  int64_t a,b,aa,bb;
  for(int64_t i=1;i<=1e9;i++){
    b=i;
    for(int64_t d:f){
      a=b+d;
      if(a>1000) break;
      else{
        aa=a*a*a*a*a;
        bb=b*b*b*b*b;
        if(aa-bb==x){
          ck=true;
          break;
        }
      }
      if(!ck){
        a=b-d;
        swap(a,b);
        if(a>1000) break;
        else{
          aa=a*a*a*a*a;
          bb=b*b*b*b*b;
          if(aa-bb==x){
            ck=true;
            break;
          }
        }
      }
    }
    if(ck) break;
  }
  cout << a << " " << b << endl;
  
}


Measured memory_bytes: 3580
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
// #define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>
#define vpipii vector<pipii>
#define vpiipi vector<piipi>
#define pb push_back
#define pob pop_back
#define pii pair<int,int>
#define pipii pair<int,pii>
#define piipi pair<pii,int>
#define pld pair<long double,long double>
// #define mod 1000000007
// #define mod 1000000009
// #define mod 163577857 
#define mod 998244353
#define rep(i,n) for (int i = 0; i < n; i++)
#define repp(i,a,b) for(int i = a ; i<b ; i++)
#define reppr(i,a,b) for(int i = a-1 ; i>=b ; i--)
#define repr(i,n) for (int i = n - 1; i >= 0; i--)
#define ff first
#define ss second
#define pc putchar_unlocked
#define gc getchar_unlocked
#define inf 9223372036854775807
#define infn -9223372036854775807
#define pi 3.14159265358979323846
#define eps 0.0000000001
#define sp << " " <<
#define setprec(x) cout << fixed << setprecision(x);
#define REVERSE(a) reverse(all(a));
#define SORT(a) sort(all(a));
#define all(n) n.begin(),n.end()
 
//GCD and LCM
    int gcd (int a, int b) { return b ? gcd (b, a % b) : a; }
    int lcm (int a, int b) { return a / gcd(a, b) * b; }
 
//Modular Exponentiation
    int powmod(int x,int y) 
    { 
        if (y == 0) return 1; 
        int p = powmod(x, y/2) % mod; 
        p = (p * p) % mod;   
        return (y%2 == 0)? p : (x * p) % mod; 
    }
 
//Modular Inverse
    int inverse(int a) 
    { 
       return powmod(a,mod-2); 
    }

//Binomial Coefficients
    int fact[500010], factinv[500010] , coefficientflag = 0;
    void Util_nCr()
    {
        fact[0] = 1 , factinv[0] = 1;
        repp(i,1,500010)
        {
            fact[i] = (fact[i-1] * i)%mod;
            factinv[i] = (factinv[i-1] * inverse(i))%mod;
        }
    }
    int nCr(int n , int r)
    {
        if(!coefficientflag) coefficientflag = 1 , Util_nCr();             
        return ((fact[n] * inverse(fact[n-r]) % mod * inverse(fact[r]))%mod) ;
    }

void solve();
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    // cin >> t; 
    rep(i,t)
    {
        // cout << "Case #" << i+1 << ": ";
        solve();
    }
}


void solve() 
{   
    char c;
    cin >> c;
    if(c>='a' && c<='z')
        cout << 'a';
    else
        cout << 'A';
}     

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#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 pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v){stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modpow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isprime(ll n){if(n<2)return 0;if(!(n%2))return !(n-2);lll d=n-1,t,y;while(!(d%2))d>>=1;vl al={2,325,9375,28178,450775,9780504,1795265022};for(ll a:al){if(n<=a)break;t=d,y=modpow(a,t,n);while(t!=n-1&&y!=1&&y!=n-1)y=y*y%n,t<<=1;if(y!=n-1&&!(t%2))return 0;}return 1;}
void dout(double d){printf("%.12f\n",d);}
void YN(bool z){cout<<(z?"YES\n":"NO\n");}
void Yn(bool z){cout<<(z?"Yes\n":"No\n");}
void yn(bool z){cout<<(z?"yes\n":"no\n");}
mt19937 rnd; void set_rnd(){random_device r;rnd=mt19937(r());}
vl fact, rfact; void set_fact(int n, ll m){fact.pb(1);rfact.pb(1);FOR(i,1,n+1)fact.pb(fact[i-1]*i%m),rfact.pb(modpow(fact[i],m,m-2));}
const int iinf = 1e9+6;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 2e5;
void init(){
  set_rnd();
//  set_fact(N);
}
int n, m, v[N];
bool s[N];
string S;
si t[N][2];
priority_queue<pii, vpii, greater<pii> > q;

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  init();
  cin >> n >> m >> S;
  FOR(i, 0, n) s[i] = S[i]=='B';
  FOR(i, 0, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    t[a][s[b]].insert(b);
    t[b][s[a]].insert(a);
    v[a] |= 1<<s[b];
    v[b] |= 1<<s[a];
  }
  FOR(i, 0, n) q.push(mp(v[i], i));
  while(!q.empty()){
    pii p = q.top();
    q.pop();
    if(p.fi != v[p.se]) continue;
    if(p.fi == 3){
      Yn(true);
      return 0;
    }
    FOR(i, 0, 2) each(itr, t[p.se][i]) if(*itr != p.se){
      t[*itr][s[p.se]].erase(p.se);
      if(t[*itr][s[p.se]].empty()){
        v[*itr] ^= 1<<s[p.se];
        q.push(mp(v[*itr], *itr));
      }
    }
  }
  Yn(false);
  return 0;
}

Measured memory_bytes: 40260
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll ans[100005];
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(b/(double)a == b/a) puts("OK");
    else if(c/(double)a == c/a) puts("OK");
    else if(c/a > b/a){
    	puts("OK");
    	
	}
	else puts("NG");
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
int main(void){
	int i=0,x,y,d;
	
	while(i<3000){scanf("%d%d",&x,&y); if(x==0 && y==0) break; if(x>y){d=x; x=y; y=d; }printf("%d %d\n",x,y); }
return 0;
}

Measured memory_bytes: 600
#include<string>
#include<iostream>
#include<cctype>
using namespace std;
int main(){
    string a,b,f,g;
    int c=0,d,e;
    cin>>a;
    d=a.size();
    while(true){
        b="";
        cin>>f;
        e=f.size();
        if(f=="END_OF_TEXT"){
            cout<<c<<endl;
            break;
        }
        for(int i=0;i<e;i++){
            b += tolower(f[i]);
        }
        if(b==a){
            c++;
        }
    }
    return 0;
}


Measured memory_bytes: 3144
n, m = map(int, input().split())
arr = list(list(input()) for _ in range(n))
rmv_row = [1] * n
rmv_col = [1] * m
for i in range(n):
    for j in range(m):
        if arr[i][j] == '#':
            rmv_row[i] = 0
            rmv_col[j] = 0
for i in range(n):
    if rmv_row[i] == 1:
        continue
    for j in range(m):
        if rmv_col[j] == 1:
            continue
        print(arr[i][j], end='')
    print()


Measured memory_bytes: 42984
#include <iostream>
#include <string>
#include <vector>

using namespace std;

class Era
{
public:
	string eraName;
	int eraBasedYear;
	int westernYear;
};

void solve()
{
	int N, Q;
	while(cin >> N >> Q, N || Q)
	{
		vector<Era> era(N);
		for(int i = 0; i < N; ++i)
		{
			cin >> era[i].eraName >> era[i].eraBasedYear >> era[i].westernYear;
		}
		for(int i = 0; i < Q; ++i)
		{
			int query;
			cin >> query;
			bool known = false;
			for(int j = 0; j < N; ++j)
			{
				if(era[j].westernYear - era[j].eraBasedYear + 1 <= query && query <= era[j].westernYear)
				{
					cout << era[j].eraName << " " << query - (era[j].westernYear - era[j].eraBasedYear) << endl;
					known = true;
					break;
				}
			}
			if(!known)
			{
				cout << "Unknown" << endl;
			}
		}
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1280