akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
using namespace std;

void Solve(double a,double b,double c,double d,double e,double f){
    double x,y;

    y = (a*f-d*c)/(a*e-d*b);
    x = (c-b*y)/a;

    if(x==0)x=0.000;
    if(y==0)y=0.000;

    printf("%4.3f %4.3f\n",x,y);
}
int main(){
    double a,b,c,d,e,f;

    while(cin >> a >> b >> c >> d >> e >> f){

    Solve(a,b,c,d,e,f);

    }
    
    return 0;
}

Measured memory_bytes: 1240
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		sc.close();
		long d = c - a - b;
		System.out.println(d > 0 && (4 * a * b) < d * d ? "Yes" : "No");
	}
}


Measured memory_bytes: 23764
#include<stdio.h>
		
int main(void)
{
	long long n;
	scanf("%lld",&n);
	long long a=10,b=0;
	
	if(n%2==1){
		printf("0");
		return 0;
		}
	else
	{
		while(a<=n){
			b+=n/a;
			a*=5;
		}
	}
	printf("%lld",b);
	return 0;
}
		

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

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

    int A, B, K; 
    cin >> A >> B >> K;
    for(int i = A; i <= min(A + K - 1, B); i++){
        cout << i << endl;
    }
    for(int i = max(min(A + K - 1, B) + 1, B - K + 1); i <= B; i++){
        cout << i << endl;
    }
    
    return 0;
}

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

int main(){
  char tenki[10];
  scanf("%s",tenki);
  if(strcmp("Sunny",tenki)==0){
    printf("Cloudy\n");
  }else if(strcmp("Cloudy",tenki)==0){
    printf("Rainy\n");
  }else if(strcmp("Rainy",tenki)==0){
    printf("Sunny\n");
  }
}

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

using namespace std;

const int N = 230 + 77 , Mod = 998244353;
int n , T[N * N] , a[N] , dp[N * N] , Inv2[N] , Pow2[N];
int S = 0;
inline int Pow(int x , long long y){
	int C = 1;
	while(y){
		if(y & 1)
         C = C * 1ll * x % Mod;
		x = x * 1ll * x % Mod;
		y >>= 1;
	}
	return C;
}
inline void Add(int x) {
   for(int i = N * N - 1;i >= x;-- i)
      dp[i] = (dp[i] + dp[i - x] * 1ll * Inv2[1]) % Mod , T[i] = (T[i - x] + T[i]) % Mod;
}
int main() {
   Pow2[0] = Inv2[0] = 1;
   for(int i = 1;i < N;++ i)
      Pow2[i] = (Pow2[i - 1] << 1) % Mod , Inv2[i] = Pow(Pow2[i] , Mod - 2);
   scanf("%d" , & n);
   T[0] = 1;
   dp[0] = Pow2[n];
   for(int i = 1;i <= n;++ i)
      scanf("%d" , a + i) , S += a[i] , Add(a[i]);
   int tot = 1;
   for(int i = 1;i <= n;++ i)
      tot = 3ll * tot % Mod;
   //cout << tot << '\n';
   for(int i = (S + 1) / 2;i <= S;++ i) {
   //   cout << i << ' ' << dp[i] << '\n';
      int r = dp[i] * 3ll % Mod;
      tot = (tot - r + Mod) % Mod;
   }
   if(S % 2 == 0) {
      int p = S / 2;
      tot = (tot + T[p] * 3ll) % Mod;
   }
   printf("%d\n" , tot);
   return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
using namespace std;
int main() {
	int a = 0, b = 0;
	cin >> a >> b;
	int result3 = std::max( a+b, a-b );
	int result4 = max( result3,a*b );
	cout << result4 <<endl;
}

Measured memory_bytes: 256
N = int(input())
hList = list(map(int, input().split()))

dp = [0] * N
dp[1] = abs(hList[0] - hList[1])

for i in range(2, N):
    tmp1 = dp[i - 1] + abs(hList[i - 1] - hList[i])
    tmp2 = dp[i - 2] + abs(hList[i - 2] - hList[i])
    if tmp1 > tmp2:
        dp[i] = tmp2
    else:
        dp[i] = tmp1

print(dp[-1])

Measured memory_bytes: 13908
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
   string s;
   long long k=0;
   cin>>s;
   for(int i=0;i<s.size();i++)
   {
       k+=s[i]-'0';
   }
   if(k%9==0)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
   return 0;
}


Measured memory_bytes: 3344
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long int a,b;
  string kotae;
  cin>>a>>b;
  if(a*b<=0){
    kotae="Zero";
  }else if(a>0&&b>0){
    kotae="Positive";
  }else if((b-a)%2==1){
    kotae="Positive";
  }else{
    kotae="Negative";
  }
  cout<<kotae;
}


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

int distance(int *a, int *b, int dim)
{
   int d;
   int norm = 0;

   for (int i = 0 ; i < dim; i++) {
      d = abs(a[i] - b[i]);
      norm += d * d;
   }

   return norm;
}

int main()
{
   int n,d;
   scanf("%d %d", &n, &d);

   int count = 0;
   int x[n][d];

   int dis = 0;

   for (int i = 0; i < n; i++) 
      for (int j = 0; j < d; j++)
         scanf("%d", &x[i][j]);

   for (int i = 0; i < n; i++) {
      for (int j = i+1; j < n; j++) {
         dis = distance(&x[i][0], &x[j][0], d);

         //test
         //printf("dis == %d\n", dis);

         bool flag = false;

         for (int k = 0; k <= dis; k++) {
            if (k * k == dis)
               flag = true;
         }

         if (flag)
            count++;

      }
   }

   printf("%d\n", count);
   return 0;
}


Measured memory_bytes: 128
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int mod = (int) (1E9+7);
		
		//[A,G,C,T]->[0,1,2,3]と置き換える。
		//012が×
		//並び替えて、012になるのもダメなので、
		//102,021,0*12,01*2もだめ。
		
		//DPで０文字から文字数を増やしていく。
		//増やした際に、ダメか否か考えるのは下３桁を見れば良い。
		
		int dp[][][][] = new int[N+1][4][4][4];
		dp[0][3][3][3]=1;//影響ない初期値を考える。
		for(int len=0;len<N;len++) {
			for(int i=0;i<4;i++) {
				for(int j=0;j<4;j++) {
					for(int k=0;k<4;k++) {
						//追加する文字a
						for(int a=0;a<4;a++) {
							if(j==0&k==1&a==2)continue;
							if(j==1&k==0&a==2)continue;
							if(j==0&k==2&a==1)continue;
							if(i==0&k==1&a==2)continue;
							if(i==0&j==1&a==2)continue;
							dp[len+1][j][k][a]+=dp[len][i][j][k];
							dp[len+1][j][k][a]%=mod;
						}
					}
				}
			}
		}
		
		long ans = 0;
		for(int i=0;i<4;i++) {
			for(int j=0;j<4;j++) {
				for(int k=0;k<4;k++) {
					ans += dp[N][i][j][k];
					ans %= mod;
				}
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
#include <cstdio>
#include <cmath>


int r, a, dr[10], da[10], cnt[10];
int hit, bro;

int main(){
    while(scanf("%d %d", &r, &a)){
        if(r == 0 && a == 0) break;

        for(int i = 0; i < 10; i++){
            dr[i] = 0;
            da[i] = 0;
            cnt[i] = 0;
        }

        hit = bro = 0;
        for(int i = 3; i >= 0; i--){
            dr[i] = (int)(r / pow(10, i)) % 10;
            da[i] = (int)(a / pow(10, i)) % 10;

            if(dr[i] == da[i]) hit++;
            else{
                cnt[dr[i]]++;
                cnt[da[i]]++;
            }
        }

        for(int i = 0; i < 10; i++){
            if(cnt[i] > 1) bro++;
        }

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

    }

    return 0;
}

Measured memory_bytes: 2760
#include<stdio.h>
#define N 1000
#define BLACK 1
#define WHITE 0
#define GRAY -1
#define INFTY 1<<21


/*入ってないのは数をおおきくして識別*/


int number;
int array[N][N];




void shortestpath(void){
  
  int d[number],color[number],p[number];
  int i,k;
  int m;


  
  for(i=0;i<number;i++){
    d[i]=INFTY;
    color[i]=WHITE;

   
  }
  
  d[0]=0;
  p[0]=-1;
  
  while(1){
    
    m=INFTY;
    int u=-1;

    for(i=0;i<number;i++){
      if(m>d[i] && color[i] !=BLACK){
	
	m=d[i];
	u=i;
      }
    }

    
    if(m==INFTY){break;}

    
    color[u]=BLACK;


    for(k=0;k<number;k++){
      if(color[k] != BLACK && array[u][k] !=INFTY){

	if(d[u]+array[u][k]<d[k]){

	  d[k]=d[u]+array[u][k];
	  p[k]=u;
	  color[k]=GRAY;
	}
      }

    }
  }

  for(i=0;i<number;i++){
    
    printf("%d %d\n",i,d[i]==INFTY ? -1: d[i]);
  }
  
}



int main(){




scanf("%d",&number);
 int i,j,k;


 for(j=0;j<number;j++){
   for(k=0;k<number;k++){

     array[j][k]=INFTY;
   }

 }

 int count,me;
 int n;
 int l;
 
   for(j=0;j<number;j++){

     scanf("%d",&me);
     scanf("%d",&count);
   for(k=0;k<count;k++){
     scanf("%d",&n);
     scanf("%d",&l);

     

      array[me][n]=l;
   }
 }




   /*

   
 for(j=0;j<number;j++){
   for(k=0;k<number;k++){

     printf("%d ",array[j][k]);
   }
   printf("\n");
 }


   */

 shortestpath();
 

 
return 0;
}



Measured memory_bytes: 2128
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

struct Read {
	long long operator()(void) {
		long long d;
		std::cin >> d;
		return d;
	}
}read;
struct ReadReal {
	double operator()(void) {
		double d;
		std::cin >> d;
		return d;
	}
}readReal;
struct ReadString {
	std::string operator()(void) {
		std::string s;
		std::cin >> s;
		return s;
	}
}readString;

struct Print {
	void operator()(double d, int digit) {
		std::cout << std::fixed << std::setprecision(digit) << d;
	}
	template <typename T>
	void operator()(T t) {
		std::cout << t;
	}
	template <typename T>
	void operator()(const vector<T> &v, const string &sep = " ") {
		if (v.empty()) return;
		Print()(v[0]);
		for(int i = 1;  i < v.size(); ++i) {
			Print()(sep);
			Print()(v[i]);
		}
		return;
	}
}print;

struct Println {
	void operator()(void) {
		std::cout << endl;
	}
	void operator()(double d, int digit) {
		print(d, digit);
		Println()();
	}
	template <typename T>
	void operator()(T t) {
		print(t);
		Println()();
	}
	template <typename T>
	void operator()(const vector<T> &v, const string &sep = " ") {
		print(v, sep);
		Println()();
		return;
	}
}println;

bool isPrime(long long x) {
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;
	long long max = std::sqrt(x);
	for (int i = 3; i <= max; i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

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

	int size = read();
	int count = 0;
	REP(i, size) {
		if (isPrime(read())) count++;
	}
	println(count);

	return 0;
}



Measured memory_bytes: 3212
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
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; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	int kkt = 89;
	while (kkt) {
		int n; scanf("%d", &n); if (n == 0) break;
		vector<string> vs(n); for (int i = 0; i < n; i++) cin >> vs[i];
		vector<ll> c(n, -1);
		for (int i = 1; i < n; i++) {
			for (int j = 0; j < vs[i].size(); j++) {
				if (vs[i][j] == '.' and vs[i][j + 1] != '.') {
					c[i] = j;
					vs[i][j] = '+';
					for (int k = i - 1; k >= 0; k--) {
						if (c[k] < j) break;
						if (c[k] == j) {
							for(int l = k + 1; l <i; l++) if (vs[l][j] != '+') vs[l][j] = '|';
							break;
						}
					}
				}
				else if (vs[i][j] == '.') vs[i][j] = ' ';
			}
		}
		for (int i = 0; i < n; i++) cout << vs[i] << "\n";
	}
	return 0;
}


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

int main() {
  int H, W, K;
  cin >> H >> W >> K;

  vector<string> C(H);
  for (int i = 0; i < H; ++i) cin >> C[i];

  int res = 0;
  for (int s = 0; s < 1 << H; ++s) {
    for (int t = 0; t < 1 << W; ++t) {
      vector<string> c = C;
      for (int i = 0; i < H; ++i) if (s >> i & 1) {
        for (int j = 0; j < W; ++j) c[i][j] = '.';
      }
      for (int i = 0; i < W; ++i) if (t >> i & 1) {
        for (int j = 0; j < H; ++j) c[j][i] = '.';
      }
      int b = 0;
      for (int i = 0; i < H; ++i)
        for (int j = 0; j < W; ++j)
          b += c[i][j] == '#';
      res += b == K;
    }
  }

  cout << res << endl;

  return 0;
}



Measured memory_bytes: 3592
package main

import (
	"fmt"
)

func main() {
	var n int

	fmt.Scanf("%d", &n)

	input := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &input[i])
	}


	max := input[0]
	answer := 0

	for _, height := range input {
		if max < height {
			max = height
		} else {
			answer += max - height
		}
	}

	fmt.Print(answer)
}

Measured memory_bytes: 6484
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int a;
  cin>>a;
  int b[200];
  int c=0;
  int d=0;
  for(int i=1;i<=a;i++){
      cin>>b[i];
      if(i==1){
       c++; 
       d=max(d,b[i]);
      }
      else{
       if(i==2){
           if(b[i-1]<=b[i]){
            c++; 
            d=max(d,b[i]);
           }
       }
       else{
        d=max(d,b[i]);
        if(d==b[i]){
         c++;   
        }
       }
      }
  }
  cout<<c<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
double ar[50009],br[50009];
double k;
double g;
double permute(string s, int l, int r)
{
    if (l == r)
    {
        for(int i=1; i<s.size(); i++)
        {
            int j=s[i]-'0';
            int x=s[i-1]-'0';
            k=k+sqrt(((ar[j]-ar[x])*(ar[j]-ar[x]))+((br[j]-br[x])*(br[j]-br[x])));
        }
        g=g+1.0;
    }
    else
    {
        for (int i = l; i <= r; i++)
        {
            swap(s[l], s[i]);
            permute(s, l+1, r);
            swap(s[l], s[i]);
        }
    }
    return k;
}
int main()
{
    int a;
    double z,y;
    cout<<fixed<<setprecision(12);
    string str = "";
    cin>>a;
    for(int i=1; i<=a; i++)
    {
        cin>>ar[i]>>br[i];
        str+=(i+'0');
    }
    int n = str.size();
    z=permute(str, 0, n-1);
    cout<<(z/g)<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;



int main()
{
	int num;
	int a, b, c;

	cin >> num;

	//cin >> a >> b >> c;

	while (cin >> a >> b >> c) {
		if (a * a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a)
			printf("YES\n");
		else
			printf("NO\n");
	}

		return (0);
	
}

Measured memory_bytes: 1116
#include "bits/stdc++.h"
#define _CRT_SECURE_NO_WARNINGS
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define Pi pair<int,int>
#define IINF 1e9
#define LINF 1e18
#define vi vector<int>
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 0, 1,0,-1 };
int dy[] = { 1, 0,-1,0 };
int dx8[] = { -1,-1,-1,0,0,1,1,1 };
int dy8[] = { -1,0,1,-1,1,-1,0,1 };

unsigned long long sttoi(std::string str) {
	unsigned long long ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

ull gcd(ull a, ull b) {
	if (b > a)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a%b);
}

int comb(int n, int k) {
	int ans = 1;
	for (int i = 0; i < min(k, n - k); i++) {
		ans *= n - i;
		ans /= i + 1;
	}
	return ans;
}

ll mod_pow(ll n, ll p, ll mod) {
	if (p == 0) return 1 % mod;
	if (p < 2) {
		return n % mod;
	}
	else {
		ll d = 2, value = (n%mod)*(n%mod) % mod;
		while (d * 2 < p) { d *= 2;	value *= value;	value %= mod; }
		value %= mod;
		return ((value%mod) * (mod_pow(n, p - d, mod) % mod)) % mod;
	}
}

bool isPrime(int n) {
	if (n <= 1)return false;
	if (n == 2)return true;
	if (n % 2 == 0)return false;
	for (int i = 3; i*i <= n; i += 2) {
		if (n%i == 0)return false;
	}
	return true;
}

void solve() {
	string a, b, c;
	cin >> a >> b >> c;
	queue<char> A, B, C;
	rep(i, a.length()) {
		A.push(a[i]);
	}
	rep(i, b.length()) {
		B.push(b[i]);
	}
	rep(i, c.length()) {
		C.push(c[i]);
	}
	int p = 0;
	while (true) {
		if (p == 0) {
			if (A.empty()) {
				P("A"); return;
			}
			char tmp = A.front();
			A.pop();
			switch (tmp) {
			case 'a':p = 0; break;
			case 'b':p = 1; break;
			case 'c':p = 2; break;
			}
		}
		else if (p == 1) {
			if (B.empty()) {
				P("B"); return;
			}
			char tmp = B.front();
			B.pop();
			switch (tmp) {
			case 'a':p = 0; break;
			case 'b':p = 1; break;
			case 'c':p = 2; break;
			}
		}
		else if (p == 2) {
			if (C.empty()) {
				P("C"); return;
			}
			char tmp = C.front();
			C.pop();
			switch (tmp) {
			case 'a':p = 0; break;
			case 'b':p = 1; break;
			case 'c':p = 2; break;
			}
		}
	}
}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define io std::ios::sync_with_stdio(false)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const double pi=acos(-1);
const ll P = 998244353, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n){ll r=1%P;for (a%=P; n; a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
const double eps=1e-5;
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int maxn=1e5+10;
int main()
{
  int a[maxn];
  int n,k;
  cin>>n>>k;
  int _min=1e9;
  for(int i=1;i<=n;i++)
  {
    cin>>a[i];
  }
if(n==k)
{
cout<<1<<endl;
return 0;
}
 cout<<(n-1-k)/(k-1)+2<<endl;

}


Measured memory_bytes: 4024
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var ABCD = Console.ReadLine();
            for (var bit = 0; bit < (1 << 3); bit++)
            {
                var sum = ABCD[0] - '0';
                var answer = $"{ABCD[0]}";
                for (var i = 0; i < ABCD.Length - 1; i++)
                {
                    if (((bit >> i) & 1) == 1)
                    {
                        sum += ABCD[i + 1] - '0';
                        answer += $"+{ABCD[i + 1]}";
                    }
                    else
                    {
                        sum -= ABCD[i + 1] - '0';
                        answer += $"-{ABCD[i + 1]}";
                    }
                }
                if (sum == 7)
                {
                    Console.WriteLine(answer + "=7");
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 25812
import sys
N,K=map(int, sys.stdin.readline().split())
LR=[ map(int, sys.stdin.readline().split()) for _ in range(K) ]

dp=[0]*(N+1)
sum_dp=[0]
mod=998244353

i=1
dp[i]=1
sum_dp.append(sum_dp[-1]+dp[i])

for i in range(2,N+1):
    for l,r in LR:
        dp[i]+=sum_dp[max(0,i-l)]-sum_dp[max(0,i-r-1)]
        dp[i]%=mod
    sum_dp.append( (sum_dp[-1]+dp[i])%mod )

print dp[-1]


Measured memory_bytes: 89588
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
    char a;
    cin >> a;
    if(a == 'a' || a == 'b' || a == 'c' || a == 'd' || a == 'e' || a == 'f'
    || a == 'g' || a == 'h' || a == 'i'  ||a == 'j' || a == 'k'||
    a == 'l' || a == 'm' || a == 'n' || a == 'o' || a == 'p' || a == 'q'
    || a == 'r' || a == 's' || a == 't'  ||a == 'u' ||a == 'v' || a == 'w' || a == 'x' || a == 'y' || a == 'z'){
        cout << 'a' << endl;
    }
    else cout << 'A' << endl;
    
}

Measured memory_bytes: 3620
a = [list(map(int,input().split())) for _ in range(3)]
n = int(input())

li = [[False]*3 for _ in range(3)]
ans = 'No'

for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                li[j][k] = True


for i in range(3):
    if False not in li[i]:
        ans = 'Yes'

for i in range(3):
    if all((li[j][i] == True for j in range(3))):
        ans = 'Yes'

for i in range(3):
    if all((li[i][i] == True for i in range(3))):
        ans = 'Yes'

for i in range(3):
    if all((li[i][2-i] == True for i in range(3))):
        ans = 'Yes'

print(ans)


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

int n, m;
vector<int> a, b;

int solve(){
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	for(int i=0; i<n-1; ++i)
		if(a[i] == a[i+1])
			return 0;
	for(int i=0; i<m-1; ++i)
		if(b[i] == b[i+1])
			return 0;
	if(a[n-1] != b[m-1] || a[n-1] != n*m)
		return 0;
	long long ret = 1, mod = 1e9+7;
	for(int i=n*m-1; i>0; --i){
		auto p = lower_bound(a.begin(), a.end(), i);
		auto q = lower_bound(b.begin(), b.end(), i);
		if(*p == i){
			if(*q == i){
//				ret *= 1;
			}else{
				ret *= b.end() - q;
				ret %= mod;
			}
		}else{
			if(*q == i){
				ret *= a.end() - p;
				ret %= mod;
			}else{
				ret *= (a.end() - p) * (b.end() - q) - (n * m - i);
				ret %= mod;
			}
		}
	}
	return ret;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> m;
	a.resize(n);
	b.resize(m);
	for(auto &i:a) cin >> i;
	for(auto &i:b) cin >> i;
	cout << solve() << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<set>
#include<unordered_map>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define lREP(i, n) for(int i = 1; i <= (int)(n); i++)
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev

int main(){
  int N;
  cin >> N;
  unordered_map<string, int> m;
  ll ans = 0;
  REP(i,N){
    string s;
    cin >> s;
    sort(ALL(s));
    ans += m[s]++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 10660
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
#include <bitset>
#include <iomanip>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  //cout<<fixed<<setprecision(10);
  ll h,n,ans=0;
  cin>>h>>n;
  vector<ll>a(n,0);
  vector<ll>b(n,0);
  for(ll i=0;i<n;i++){
    cin>>a[i]>>b[i];
  }
  vector<ll>dp(h+1,1e9);
  dp[h]=0;

  for(ll i=h;i>=0;i--){
    for(ll j=0;j<n;j++){
      ll x=max((ll)0,i-a[j]);
      dp[x]=min(dp[i]+b[j],dp[x]);
    }
  }
  cout<<dp[0]<<endl;
}


Measured memory_bytes: 384
from math import sqrt
from math import factorial
 
n = int(input())
t = []
for i in range(n):
  t.append(list(map(int,input().split())))
l = [[0]*n for j in range(n)]
for k in range(n):
  for m in range(n):
      l[k][m] = sqrt((t[k][0]-t[m][0])**2+(t[k][1]-t[m][1])**2)
ans = 0
for i in range(n):
  s = sum(l[i])
  ans += s*factorial(n-1)
z = ans/factorial(n)
print(z)

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

int main() {
    // int n;
    // vector<int> a(n);
    // for(int i = 0; i < n; i++) {
    //     cin >> a[i];
    // }
    string weather;
    string next;
    cin >> weather;
    if (weather == "Sunny") next = "Cloudy";
    if (weather == "Cloudy") next = "Rainy";
    if (weather == "Rainy") next = "Sunny";
    cout << next << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>

using ll = long long;
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (b >= a) {
		cout << min(a, b);
	}
	else {
		cout << a - 1;
	}
}







Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
 
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
 
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
 
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
 
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
 
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i64,
        b: i64,
    }
    println!("{} {}", a*b, 2*(a+b));
}
//nを入力後ctrl+Z


Measured memory_bytes: 5032
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
#define ll long long int
const double mx = 2e6 + 5 ;

void solve()
{
	ll x, n, num;
	cin>>x>>n;
	set<int> st;
	REP(i, n)
	{
		cin>>num;
		st.insert(num);
	}
	int diff = 10000;
	num = 10000;
	for(int i=-1000; i<1000; i++)
	{
		if(!st.count(i))
		{
			if(abs(i-x)<diff)
			{
				diff = abs(i-x);
				num = i;
			}
			else if(abs(i-x)==diff)
			{
				if(i<num)
				{
					i = num;
				}
			}
		}
	}
	cout<<num<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t = 1;
//	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

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

bool ok(ll n,ll x)
{
    while (n%x==0) n/=x;
    return (n-1)%x==0;
}

int main()
{
    ll n,ans=0;
    scanf("%lld",&n);
    for (int i=2;1LL*i*i<=n;i++) {
        if (n%i==0) {
            ans+=ok(n,i);
            if (1LL*i*i!=n) ans+=ok(n,n/i);
        }
    }
    ++ans;
    --n;
    ll aa=1;
    for (int i=2;1LL*i*i<=n;i++) {
        if (n%i==0) {
            ll tmp=0;
            while (n%i==0) {
                n/=i;
                ++tmp;
            }
            aa*=(tmp+1);
        }
    }
    if (n!=1) aa*=2;
    ans+=aa-1;
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define fir first
#define sec second
#define mod 998244353
#define ll long long
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
inline char rdchar()
{
	char ch=getchar();
	while(!(ch>='a'&&ch<='z')&&!(ch>='A'&&ch<='Z')&&!(ch>='0'&&ch<='9')) ch=getchar();
	return ch;
}
typedef pair<int,int> pii;
#define N ((1<<21)+5)
int fir[N][2];
int *f[N];
int pool[N*23],*p=pool;
int n,k;
pair<string,int> get(int x)
{
	for(int j=22;j>=0;j--)
	{
		if(x>>j&1)
		{
			string ans;
			for(int i=j-1;i>=0;i--)
			{
				if(x>>i&1) ans+='1';
				else ans+='0';
			}
			return mp(ans,j);
		}
	}
	assert(0);
}
int rev(int x)
{
	for(int j=22;j>=0;j--)
	{
		if(x>>j&1)
		{
			int res=1<<j;
			for(int i=0;i<j;i++)
			{
				if(x>>i&1) res|=(1<<(j-i));
			}
			return res;
		}
	}
	assert(0);
}
signed main()
{
	cin>>n>>k;
	int cur=1;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<(1<<i);j++)
		{
			// printf("%d %d\n",i,j);
			int x=rdchar()-'0';
			int ct=(1<<(n-i+1))+2;
			f[cur]=p;
			p+=ct;
			if(x) f[1][cur]=1;
			fir[cur][0]=fir[cur][1]=25;
			for(int k=0;k<=i-1;k++) fir[cur][j>>k&1]=k;
			// printf("%d %d %d\n",cur,fir[cur][0],fir[cur][1]);
			cur++;
		}
	}
	cur=1;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<(1<<i);j++)
		{
			int qaq=1;
			for(int k=0;k<=n-i;k++)
			{
				for(int c=0;c<(1<<k);c++)
				{
					if(fir[qaq][0]!=25) f[cur*2][((c)&((1<<(fir[qaq][0]))-1))+(1<<(fir[qaq][0]))]+=f[cur][qaq];
					if(fir[qaq][1]!=25)
					{
						// printf("%d %d %d\n",qaq,c,((c)&((1<<(fir[qaq][1])-1)))+(1<<(fir[qaq][1])));
						f[cur*2+1][((c)&((1<<(fir[qaq][1]))-1))+(1<<(fir[qaq][1]))]+=f[cur][qaq];
					}
					qaq++;
				}
			}
			cur++;
		}
	}
	cur=1; string ans="";
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<(1<<i);j++)
		{
			int maxn=0,qaq=1;
			for(int k=0;k<=n-i;k++)
			{
				for(int c=0;c<(1<<k);c++)
				{
					// printf("%d %d : %d\n",cur,qaq,f[cur][qaq]);
					maxn+=f[cur][qaq];
					qaq++;
				}
			}
			if(maxn>=k)
			{
				// cout<<cur<<endl;
				auto [str,len]=get(cur);
				// cout<<str<<endl;
				if(len>(int)ans.length()||str<ans) ans=str;
			}
			cur++;
		}
	}
	cout<<ans<<endl;
	return 0;
}
/*
-, 1, 00, 10, 11, 001, 100, 101, 110
*/



Measured memory_bytes: 224796
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	int ans = n;
	rep(i, n - 1) {
		if (a[i] < a[i + 1]) {
			ans--;
		}
	}
	cout << ans << endl << n << endl;
	return 0;
}



Measured memory_bytes: 3592
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
long long ma(long long a,long long b){
if(a>b)
    return a;
else return b;
}
int main()
{
   int n,w;
   cin>>n>>w;
   int a[n],b[n];
   for(int i=0;i<n;i++)
    cin>>a[i]>>b[i];
   long long c[w+1][n+1];
   for(int i=0;i<=n;i++)
    c[0][i]=0;
    for(int i=0;i<=w;i++)
        c[i][n]=0;
   for(int i=1;i<=w;i++){
    for(int j=n-1;j>=0;j--){
        c[i][j]=c[i][j+1];
        if(i>=a[j])
            c[i][j]=ma(c[i][j],b[j]+c[i-a[j]][j+1]);
    }
   }
  cout<<c[w][0];
}


Measured memory_bytes: 79104
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define FOR(i,x,n) for(ll i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e12)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

map<ll, ll> minimum;
vector<int> a;
arr<ll> nums;

bool isprime(ll n){
if(!(n&1)) return false;
for(ll i=3; i*i < n; i+=2){
if(n%i==0) return false;
}
return true;
}

void make(ll n){
    ll nn = n;
    vector<ll> f;
    if(n%2==0){
        f.push_back(2);
        n /= 2;
        while(n!=1 && n%2==0){
            n /= 2;
        }
    }

    for(ll i=3; i*i <= n; i+=2){
        if(n%i==0){
            f.push_back(i);
            n /= i;
            while(n!=1 && n%i==0){
                n /= i;
            }
        }
    }

    if(n!=1) f.push_back(n);

    // pr(nn);
    // prvec(f);

    ll tmp=1;
    rep(i, f.size()) tmp *= f[i];
    if(minimum[tmp]==0) minimum[tmp] = nn;
    else{
        if(minimum[tmp] > nn) minimum[tmp] = nn;
    }

    nums.push_back(f);
}

#define MAX 1000010
int main(){
    int n; cin >>n;
    a.resize(n);
    rep(i, n){
        cin >> a[i];
    }

    sort(ALL(a));

    vector<bool> dp(MAX, false);
    rep(i, n){
        if(dp[a[i]]) continue;
        if(i<n-1 && a[i] == a[i+1]) dp[a[i]] = true;
        int k = a[i]*2;
        while(k < MAX){
            dp[k] = true;
            k += a[i];
        }
    }

    int cnt=0;
    rep(i, n){
        if(dp[a[i]]==false) cnt++;
    }
    pr(cnt);
}

// int main()
// {
//     ll n; cin >> n;
//     a.resize(n);
//     rep(i, n){
//         cin >> a[i];
//         make(a[i]);
//     }

//     // for(auto p: minimum){
//     //     prllf("%d %d\n", p.first, p.second);
//     // }

//     map<ll, ll> primes;
//     ll cnt = 0, t=0;
//     rep(i, n){
//         if(isprime(a[i])){
//             // prllf("a)\n");
//             primes[a[i]]++;
//             continue;
//         }

//         bool flag = true;
//         ll size = nums[i].size();

//         for(ll j=1; j < (1<<size); i++){
//             ll k = 1;
//             rep(c, size) {
//                 if(j & (1<<c)) k *= nums[i][c];
//             }
//             if(minimum[k]==0) continue;
//             if(minimum[k]==a[i]) continue;
//             if(a[i]%minimum[k] == 0){
//                 // prllf("%d %d !\n", a[i], minimum[k]);
//                 t++;
//                 flag = false;
//                 break;
//             }
//         }

//         if(flag) cnt++;
//     }

//     for(auto p: primes){
//         if(p.second!=1) t += p.second;
//     }

//     pr(n-t);
//     return 0;}

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

int main(){
	long long int x,y,z;
	cin>>x>>y>>z;
	bool genap=false;
	long long int temp=abs(x/z);
	long long int ans;
	if(y<temp){
		ans=x-(y*z);
		if(x<0){
			ans=x+(y*z);
		}
		cout<<abs(ans)<<endl;
		return 0;
	}
	long long int min;
	min=abs(x%z);
	long long int indikator;
	indikator=abs(x/z);
	long long int left,right;
	left=abs(min-z);
	right=abs(min+z);
	int a=0;

	if(y%2==0){
		
		a=1;
		
	}

	if(indikator%2==0){
		genap=true;
		
	}
	else
	{
		
		genap=false;
		
	}
	if(a==genap){
		cout<<min<<endl;
		return 0;
	}
	else
	{
		if(left<right){
			cout<<left<<endl;
			return 0;
		}
		else
		{
			cout<<right<<endl;
			return 0;
		}
	}

}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
#define all(x) x.begin(), x.end()

signed main() {
	int n, x, t;
	cin>>n>>x>>t;
	int ti;
	if(n%x) ti=n/x+1;
	else ti=n/x;
	cout<<ti*t<<endl;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define RI register int

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc();
  while (ch < '0' || ch > '9') ch = gc();
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
}

int const MAXN = 3005;
struct Edges {
  int to, next;
} e[MAXN * 2];
int head[MAXN], tot, a[MAXN];

inline void addedge(int from, int to) {
  e[++tot] = (Edges){to, head[from]};
  head[from] = tot;
  e[++tot] = (Edges){from, head[to]};
  head[to] = tot;
}

bool Check(int now) {
  int flag = 0;
  for (RI i = head[now]; i; i = e[i].next)
    if (a[e[i].to] < a[now]) flag |= Check(e[i].to);
  return flag ^ 1;
}

int main() {
 // freopen("game.in", "r", stdin);
 // freopen("game.out", "w", stdout);
  int n; read(n);
  for (RI i = 1; i <= n; ++i) read(a[i]);
  for (RI i = 1, x, y; i < n; ++i)
    read(x), read(y), addedge(x, y);
  for (RI i = 1; i <= n; ++i)
    if (!Check(i)) printf("%d ", i);
  return 0;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

struct Point : public complex<double>
{
public:
  Point() { this->real(0);  this->imag(0); }
  Point(const double& x, const double& y) { this->real(x);  this->imag(y); }
  Point(const complex<double> w)  { this->real(w.real());  this->imag(w.imag()); }
  inline double dot(Point p){ return (conj(*this) * p).real(); }  // ??????
  inline double det(Point p){ return (conj(*this) * p).imag(); }  // ??????
};

namespace std
{
  bool operator < (const Point& a, const Point& b)
  {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
typedef vector<Point> Polygon;
#define currPoint(P, i) P[i]
#define nextPoint(P, i) P[(i+1)%P.size()]

template<typename T> ostream& operator <<(ostream& r, const vector<T> t){vrep(v,t)r<<*v<<(v+1==t.end()?"":" ");return r;}
template<typename T> ostream& operator <<(ostream& r, const pair<vector<T>, int> p){int n=p.second;minup(n,p.first.size());rep(i,n-1)r<<p.first[i]<<' ';r<<p.first[n-1];return r;}
template<typename T> ostream& operator <<(ostream& r, const pair<T*, int> p){int n=p.second-1;rep(i,n)r<<p.first[i]<<' ';return r<<p.first[n];}
template<typename T, size_t S> ostream& operator <<(ostream& r, const T (&a)[S]){rep(i,S-1)r<<a[i]<<' ';return r<<a[S-1];}


double x, y;
vector<double> ix, iy;
double theta = 90.0;
Point res;

int main()
{
  iy.pb(theta * M_PI / 180.0);

  while(~scanf("%lf,%lf", &x, &y) && (x || y)){
    theta -= y;
    ix.pb(x);
    iy.pb(theta * M_PI / 180.0);
  }

  rep(i, ix.size()) res += polar(ix[i], iy[i]);

  printf("%d\n%d\n", static_cast<int>(res.real()), static_cast<int>(res.imag()));

  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  ll n,count=1;
  cin>>n;
  vector<string> vec;
  vec.resize(n);
  cin>>vec.at(0);
  for(ll i=1;i<n;i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(),vec.end());
  for(auto v:vec){}
  for(ll i=1;i<n;i++){
    if(vec.at(i-1)==vec.at(i)){}
    else{count++;}
  }
  cout<<count<<endl;
} 

Measured memory_bytes: 9604
#111_C
from collections import Counter
n=int(input())
v=list(map(int,input().split()))
v1=[v[2*i] for i in range(n//2)]
v2=[v[2*i+1] for i in range(n//2)]

V1=Counter(v1).most_common()
V2=Counter(v2).most_common()

V1.append((0,0))
V2.append((0,0))

Ans=n-V1[0][1]-V2[0][1]

if V1[0][0]==V2[0][0]:
    Ans+=min(V1[0][1]-V1[1][1],V2[0][1]-V2[1][1])
     
print(Ans)

Measured memory_bytes: 21084
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int X = int.Parse(input[0]);
        int A = int.Parse(input[1]);
        if(X < A)
        {
            Console.WriteLine(0);
        }
        else
        {
            Console.WriteLine(10);
        }
    }
}

Measured memory_bytes: 11092
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int y, x;
		y = s.nextInt();
		x = s.nextInt();

		char[][] mat = new char[y][x];
		mat[0] = s.nextLine().toCharArray();

		for(int i = 0; i < y; i++){
			mat[i] = s.nextLine().toCharArray();
		}

		Boolean possible = true;
		for(int i = 0; i < y; i++){
			for(int j = 0; j < x; j++){
				if(mat[i][j] == '#'){
					if(i != 0 && mat[i - 1][j] == '#'){

					} else if(i != y - 1 && mat[i + 1][j] == '#'){

					} else if(j != 0 && mat[i][j - 1] == '#'){

					} else if(j != x - 1 && mat[i][j + 1] == '#'){

					} else {
						possible = false;
					}
				}
			}
		}

		if(possible){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

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

using i64 = long long;

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

const int MOD = 1000000007;

i64 pow64(i64 a, i64 b) {
    a %= MOD;
    i64 result = 1;
    while(b) {
        if(b & 1) result = result * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return result;
}
i64 inv64(i64 x) { return pow64(x, MOD - 2); }

const int MAXN = 101000;

int n;
int arr[MAXN];
int cnt[MAXN];
int fac[MAXN];
int result[MAXN];
int p, q, d, l, r;

i64 cc(int a, int b) { return b >= 0 && b <= a ? fac[a] * inv64(i64(fac[b]) * fac[a - b]) % MOD : 0; }

int main() {
    std::scanf("%d", &n);
    for(int i = 0; i < n + 1; ++i) {
        std::scanf("%d", &arr[i]);
        --arr[i];
        if(++cnt[arr[i]] == 2) q = i;
    }
    for(int i = 0; i < n + 1; ++i)
        if(cnt[arr[i]] == 2) { p = i; break; }
    d = q - p - 1;
    l = p;
    r = n - q;
    fac[0] = fac[1] = 1;
    for(int i = 2; i <= n + 1; ++i)
        fac[i] = i64(fac[i - 1]) * i % MOD;
    // result[1] = n;
    // result[n + 1] = 1;
    for(int i = 1; i <= n + 1; ++i) {
        i64 s = (cc(n - 1, i) + cc(n - 1, i - 2)) % MOD;
        s = ((s + (cc(n - 1, i - 1) - cc(n - 1 - d, i - 1)) * 2 + cc(n - 1 - d, i - 1)) % MOD + MOD) % MOD;
        result[i] = s;
    }
    for(int i = 1; i <= n + 1; ++i)
        std::printf("%d\n", result[i]);
}

Measured memory_bytes: 2816
import math
n=a=int(input())
len=0
while a>=1:
  a=math.ceil(a/26)
  a-=1
  len+=1
  n-=26**len
n+=26**len-1
dp=[0]*len

for i in range(len):
  s=26**(len-i-1)
  dp[i]=chr(n//s+ord("a"))
  n-=26**(len-i-1)*(n//s)
print("".join(dp))



Measured memory_bytes: 62032
// :)
// "Khodaya, be man "Tagwaye setiz" biamooz ta
//  dar anbuh masuliat nalaghzam ..." -Shariati
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define F first
#define S second
#define MP make_pair

const int MAX = 3e5+9;
const ll MOD = 1e9+7;

int e[MAX], w[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n;
	string s;
	cin >> n >> s;
	for (int i = 1; i < s.length(); i++)
		w[i] = w[i-1] + ((s[i-1] == 'W') ? 1 : 0);
	for (int i = s.length()-2; i >= 0; i--)
		e[i] = e[i+1] + ((s[i+1] == 'E') ? 1 : 0);
	int res = n;
	for (int i = 0; i < n; i++)
		res = min(res, w[i] + e[i]);
	cout << res << "\n";
}

Measured memory_bytes: 2964
def lcs(m,n):
    N = len(n)
    dp = [0]*(N+1)
    for x in m:
        cp_dp = dp[:]
        for i ,y in enumerate(n):
            if x == y :
                dp[i+1] = cp_dp[i] +1 
            else:
                if dp[i+1] < dp[i]:
                    dp[i+1] = dp[i]
    return dp[N]

a = int(input())

for b in range(a):
    m = input()
    n = input()
    print(lcs(m,n))


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

const int MAXN = 40;
const int P = 1e9 + 7;

inline int add(int a, int b) { return a + b >= P ? a + b - P : a + b; }
inline int sub(int a, int b) { return a - b < 0 ? a - b + P : a - b; }
inline int mul(int a, int b) { return 1LL * a * b % P; }
inline void inc(int &a, int b) { a = add(a, b); }
inline void dec(int &a, int b) { a = sub(a, b); }
inline void mlt(int &a, int b) { a = mul(a, b); }

int ans = 1;
int n, X, Y, Z, mask, valid;
int dp[MAXN + 9][1 << 17];

int main() {
  scanf("%d%d%d%d", &n, &X, &Y, &Z);
  mask = (1 << X + Y + Z) - 1;

  valid = (1 << X + Y + Z - 1) | (1 << Y + Z - 1) | (1 << Z - 1);
  // 满足要求的最小状态

  for (int i = 1; i <= n; ++i) mlt(ans, 10);

  dp[0][0] = 1;
  for (int i = 1; i <= n; ++i) 
    for (int s = 0; s <= mask; ++s) {
      if (!dp[i - 1][s]) continue;
      for (int j = 1; j <= 10; ++j) {
        int now = ((s << j) | (1 << j - 1)) & mask;
        if ((now & valid) != valid) inc(dp[i][now], dp[i - 1][s]);
      }
    }

  for (int s = 0; s <= mask; ++s) dec(ans, dp[n][s]);

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

  return 0;
}

Measured memory_bytes: 20864
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

typedef long long ll;

const int N=605,Mo=1e9+7;

int n,a[N],f[N][N],g[N][N],tot;
bool used[N],single[N];

void inc(int &x,int y) {x=x+y>=Mo?x+y-Mo:x+y;}

int main() {
	scanf("%d",&n);
	fo(i,1,n<<1) scanf("%d",&a[i]);
	fo(i,1,n) {
		if (a[(i<<1)-1]!=-1&&a[(i<<1)]!=-1) {
			used[a[(i<<1)-1]]=1;
			used[a[(i<<1)]]=1;
			continue;
		}
		if (a[(i<<1)-1]==-1&&a[i<<1]==-1) ++tot;
		else {
			if (a[(i<<1)-1]==-1) single[a[i<<1]]=1;
			else single[a[(i<<1)-1]]=1;
		}
	}
	f[0][0]=1;
	fd(i,2*n,1) {
		if (used[i]) continue;
		fo(j,0,n*2) fo(k,0,n) g[j][k]=0;
		fo(j,0,n*2)
			fo(k,0,n)
				if (f[j][k]) {
					int now=f[j][k];
					if (single[i]) {
						inc(g[j][k+1],now);
						if (j) inc(g[j-1][k],now);
					} else {
						if (j) inc(g[j-1][k],now);
						if (k) inc(g[j][k-1],(ll)now*k%Mo);
						inc(g[j+1][k],now);
					}
				}
		fo(j,0,n*2) fo(k,0,n) f[j][k]=g[j][k];
	}
	int ans=f[0][0];
	fo(i,1,tot) ans=(ll)ans*i%Mo;
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;


int main(){
	int n;
	cin >>n;
	int A[n],B[n], C[n];
	for(int i = 0;i<n;i++){
		cin >> A[i] >> B[i] >> C[i];
		// cout << A[i] << B[i] << C[i] ;
	}

	int dp[n][3];
	dp[0][0] = A[0];
	dp[0][1] = B[0];
	dp[0][2] = C[0];
	for(int i = 1;i<n;i++){
		dp[i][0] = max(dp[i-1][1] , dp[i-1][2]) + A[i];
		dp[i][1] = max(dp[i-1][0] , dp[i-1][2]) + B[i];
		dp[i][2] = max(dp[i-1][0] , dp[i-1][1]) + C[i];
	}

	cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])) << "\n";
	return 0;
}

Measured memory_bytes: 2560
A = list(input())
B = list(input())
C = list(input())
tmp = A.pop(0)
while True:
    if tmp == "a":
        if len(A) == 0:
            print("A")
            break
        else:
            tmp = A.pop(0)
    if tmp == "b":
        if len(B) == 0:
            print("B")
            break
        else:
            tmp = B.pop(0)
    if tmp == "c":
        if len(C) == 0:
            print("C")
            break
        else:
            tmp = C.pop(0)


Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
import itertools
import math

N, D = map(int, input().split())

X = [[0 for x in range(D)] for y in range(N)]

for n in range(N):
    X[n] = list(map(int, input().split()))

count = 0
for target in itertools.combinations(X, 2):
    y = target[0]
    z = target[1]
    res = 0
    for i in range(D):
        res += (y[i] - z[i])**2

    res = math.sqrt(res)
    if res.is_integer():
        count += 1

print(count)


Measured memory_bytes: 3064