akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <random>
#include <stdio.h>
#include <bitset>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef string ST;


#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) for(auto (a): v )   cerr << a << endl
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl


void func() {
  LL N;
  string S1;
  string S2;
  cin >> N;
  cin >> S1;
  cin >> S2;

  LL cnt;
  LL i;
  LL mode;
  if (S1[0] == S2[0]) {
    mode = 0;
    cnt = 3;
    i = 1;
  }
  else {
    mode = 1;
    cnt = 6;
    i = 2;
  }
  while (i < N) {
    if (mode == 0) {
      if (S1[i] == S2[i]) { // AA
        cnt *= 2;
        mode = 0;
        i += 1;
      }
      else { //AB
        cnt *= 2;
        mode = 1;
        i += 2;
      }
    }
    else {
      if (S1[i] == S2[i]) { // BA
        cnt *= 1;
        mode = 0;
        i += 1;
      }
      else { //BB
        cnt *= 3;
        mode = 1;
        i += 2;
      }
    }
    cnt %= 1000000007;
  }
  cout << cnt;





}

#ifdef CALC_TIME 
#include <windows.h>
int main()
{
  LARGE_INTEGER freq;
  QueryPerformanceFrequency(&freq);
  LARGE_INTEGER start, end;
  QueryPerformanceCounter(&start);
  // 何かの処理
  func();
  QueryPerformanceCounter(&end);
  double time = static_cast<double>(end.QuadPart - start.QuadPart) * 1000.0 / freq.QuadPart;
  fprintf(stderr, "\n%lf[ms]\n", time);
  return 0;
}
#else 
int main()
{
  func();
  return 0;
}
#endif





Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
string s = "AKIHABARA";
string mok;
void dfs(string t, int x)
{
	if (x == 9)
	{
		if (t == mok)
		{
			printf("YES\n");
			exit(0);
		}
		return;
	}
	if (s[x] == 'A')dfs(t, x + 1);
	t.push_back(s[x]);
	dfs(t, x + 1);
}
int main()
{
	cin >> mok;
	dfs("", 0);
	printf("NO\n");
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define ALL(v) v.begin(),v.end()
#define LLINF 1000000000000000000LL
typedef long long ll;

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

	int n;cin >> n;
	int ans = 0;
	vector<ll> v(n + 10, LLINF);

	REP(i, n){
		ll now;cin >> now;
		auto it = upper_bound(ALL(v), -now);
		if(*it == LLINF){
			ans++;
		}
		*it = -now;
	}

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


Measured memory_bytes: 1024
s = gets.strip.split('')
t = gets.strip.split('')


(s.length-t.length+1).times do |ii|
  i = s.length-t.length-ii
  
  restorable = s[i...i+t.length].zip(t).all? do |l, r|
    l=='?' || l==r
  end

  if restorable
    ds = s.dup
    ds[i...i+t.length] = t
    puts ds.join('').gsub('?', 'a')
    exit
  end
end

puts 'UNRESTORABLE'



Measured memory_bytes: 1788
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=5e5+50;
const ll mod=1e9+7;
using namespace std;
ll n,m,i,cur,rs,f[nmax],in[nmax];
ll pw(ll x,ll p)
{
	ll ans=1;
	while(p)
	{
		if(p&1LL)ans=ans*x%mod;
		x=x*x%mod;
		p>>=1LL;
	}
	return ans;
}
ll c(ll n,ll m)
{
	return f[n]*in[m]%mod*in[n-m]%mod;
}
ll a(ll n,ll m)
{
	return f[n]*in[n-m]%mod;
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>m;
	f[0]=in[0]=1;
	for(i=1;i<=m;i++)
	{
		f[i]=f[i-1]*i%mod;
		in[i]=pw(f[i],mod-2);
	}
	for(i=0;i<=n;i++)
	{
		cur=c(n,i)*a(m-i,n-i)%mod;
		if(i&1)rs=(rs-cur+mod)%mod;
		else rs=(rs+cur)%mod;
	}
	for(i=1;i<=n;i++)rs=rs*(m-i+1)%mod;
	cout<<rs<<endl;
	return 0;
}


Measured memory_bytes: 11408
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) { 
            String line = sc.nextLine();
            StringBuilder answer = new StringBuilder("");
            int length = line.length();
            for (int i = 0; i < length; i++) {
                char ch = line.charAt(i);
                if(Character.isLowerCase(ch)){
                    answer.append(Character.toUpperCase(ch));

                }else if(Character.isUpperCase(ch)){
                    answer.append(Character.toLowerCase(ch));
                }else{
                    answer.append(ch);
                }
            }
            System.out.println(answer);
        }
    } 
}


Measured memory_bytes: 26448
#include <bits/stdc++.h>
#include <limits>
#include <math.h>
#include <cmath>
#include <cctype>
#include <cstdio>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll> ;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vvll = vector<vector<long long >>;
#define PI  3.1415926535
#define rep(i, k, n) for(ll i = k; i < n; i++)

int main(){
  	ll MOD = 1000000007;
	ll n; cin >> n;
    vll a(n);
    rep(i, 0, n){cin >> a[i];}
    
    vll count1(100, 0);
    vll sum(100);
    
    rep(i, 0, n){
    	vll shinsu (0);
        while(a[i] > 1){
        	shinsu.emplace_back(a[i]%2);
            a[i] /= 2;
        }
      	if(a[i] != 0){shinsu.emplace_back(1);}
      	else{shinsu.emplace_back(0);}
      
      //for(auto x:shinsu){cout << x;}
      //cout << endl;
      	
      rep(j, 0, shinsu.size()){if(shinsu[j] == 1){count1[j]++;}}
    }
  //cout << count1[0] << count1[1] << count1[2] << count1[3] << endl;
  ll ans = 0;
  rep(i, 0, 100){
    sum[i] = count1[i] * (n - count1[i]);
    ll res = pow(2, i);
    ans += ((sum[i] % MOD) * (res % MOD)) % MOD;
    ans %= MOD;
  }
  
  cout << ans << endl;
}
  
  
    
    

Measured memory_bytes: 5616
#include <stdio.h>

int main(int argc, char *args[])
{
	int a,b,c;
	int i;
	int count=0;

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

	for( i=a; i<=b; i++ ) {
		if( c % i == 0 ) {
			count++;
//			printf("%d\n", i);
		}
	}

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

	return 0;

}

Measured memory_bytes: 596
#include <stdio.h>
#include <string.h>
#define MAX 10000
int B[MAX],T[MAX+1];

void sort(int A[], int n){
	int f=1;
	int tmp;
	while(f==1){
		f = 0;
		for(int j=n-1;j>=1;j--){
			if(A[j]<B[j-1]){
				tmp=A[j-1];
				A[j-1]=A[j];
				A[j]=tmp;
				f=1;
			}
		}
	}
}

int min(int a,int b){
    if(a<b){
    	return a;
    }
    return b;
}

int solve(int A[], int n, int s){
	
	int ans=0;
	int V[MAX];
	for(int i=0;i<n;i++){
		B[i]=A[i];
		V[i]=0;
	}
	
	sort(B ,n);
	
	for(int i=0;i<n;i++){
		T[B[i]]=i;
	}
	for(int i=0;i<n;i++){
		if(V[i]==1){
			continue;
		}
		int cur=i;
		int S=0;
		int m=MAX;
		int an=0;
		
		while(1){
			V[cur]=1;
			an++;
			int v=A[cur];
			m=min(m,v);
			S+=v;
			cur=T[v];
			if(V[cur]){
				break; 
			}
		}
		ans+=min(S+(an-2)*m,m+S+(an+1)*s);
		
	}
	
	return ans;
	
}


int main(void){
	int n, s=MAX;
	scanf("%d", &n);
	int A[n];
	for(int i=0 ; i<n ; i++){
		scanf("%d",&A[i]);
		s = min(s,A[i]);
	}
	printf("%d\n",solve(A, n, s));
	return 0;
}


Measured memory_bytes: 2144
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <utility>
#include <set>
#include <numeric>
using namespace std;
using LLI = long long int;

#define Rep(i, N) for (int i=0; i<N; i++)

int main(int argc, char *argv[])
{
    int N;
    cin >> N;
    vector<pair<int, int>> v;
    Rep(i, N) {
        int a, b;
        cin >> a >> b;
        v.emplace_back(b, a);
    }

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

    LLI t = 0;
    bool ok = true;
    Rep(i, N) {
        t += v[i].second;
        if (t > v[i].first) {
            ok = false;
            break;
        }
    }

    if (ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }



    return 0;
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

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

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

    ll N;
    string A,B;
    bool flag = true;
    cin >> A >> B;

    ll A_size = A.size();
    ll B_size = B.size();

    if(A==B){
        cout << "EQUAL" << endl;
    }
    else if(A_size>B_size){
        cout << "GREATER" << endl;
    }
    else if (A_size < B_size)
    {
        cout << "LESS" << endl;
    }
    else{
        REP(i,A.size()){
            ll a = A.at(i) - '0';
            ll b = B.at(i) - '0';
            if(a>b){
                cout << "GREATER" << endl;
                flag = flase;
                break;
            }
            else if(a<b){
                cout << "LESS" << endl;
                flag = flase;
                break;
            }
        }
        if(flag){
            cout << "EQUAL" << endl;
        }
    }
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
int a[200005];
int main()
{
       ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);int n;
       cin >> n;
       int ans=0;
       for (int i=0; i<n; i++)
       {
             cin >> a[i];
             if (i==0) ans=a[i];
             else ans=ans^a[i];
       }
       for (int i=0; i<n; i++)
       {
             cout << (ans^a[i]) << " " ;
       }
	return 0;
}



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

int main() {
  int N;
  cin >> N;
  long long H[N];
  for (int i = 0; i < N; i++) cin >> H[i];

  long long maxv = 0;
  for (int i = 0; i < N-1; i++) {
    long long sum = 0;
    while (H[i] >= H[i+1]) {
      sum++;
      i++;
    }
    if (maxv < sum) {
      maxv = sum;
    }
  }

  cout << maxv << endl;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] tmpArray = br.readLine().split(" ");
		
		int h = Integer.parseInt(tmpArray[0]);
		int w = Integer.parseInt(tmpArray[1]);
		
		int map[][] = new int[h + 1][w + 1];
		
		//初期化
		for(int i = 0; i < map.length ; i++){
			Arrays.fill(map[i], Integer.MAX_VALUE);
		}
		map[0][1] = 0;
		
		for(int i = 0; i < h; i++){
			String str = br.readLine();
			for(int j = 0; j < w; j++){
				map[i + 1][j + 1] = str.charAt(j) - '0';
			}
		}
		
		for(int i = 1; i <= h; i++){
			for(int j = 1; j <= w; j++){
				map[i][j] += Math.min(map[i - 1][j], map[i][j - 1]);
				
				//debug
//				for(int i = 1; i < h; i++){
//					for(int j = 1; j < w; j++){
//						
//					}
//				}
			}
		}
		
		System.out.println(map[h][w]);
	}

}



Measured memory_bytes: 24484
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
void printout(vector<int> vec){
  REP(i,vec.size())cout<<vec[i]<<" ";
  cout<<endl;
}
int main(void){
  int n;
  int m;
  while(cin>>n,n){
    vector<int> t_length;
    vector<int> t_direct;
    vector<int> t_diff;
    {
      cin>>m;
      int x,y;
      cin>>x>>y;
      int nx,ny;
      REP(i,m-1){
        cin>>nx>>ny;
        int lx = nx-x;
        int ly = ny-y;
        t_length.push_back(abs(lx+ly));
        REP(r,4){
          if(lx)lx /= abs(lx);
          if(ly)ly /= abs(ly);
          if(dx[r]==lx&&dy[r]==ly)
              t_direct.push_back(r);
        }
        x = nx;
        y = ny;
      }
      REP(i,t_direct.size()-1){
        int dif = t_direct[i+1]-t_direct[i];
        if(dif==3) dif -= 4;
        if(dif==-3) dif+=4;
        t_diff.push_back(dif);
      }
    }
    REP(j,n){
      vector<int> length;
      vector<int> direct;
      vector<int> diff;
      cin>>m;
      int x,y;
      cin>>x>>y;
      int nx,ny;
      REP(i,m-1){
        cin>>nx>>ny;
        int lx = nx-x;
        int ly = ny-y;
        length.push_back(abs(lx+ly));
        REP(r,4){
          if(lx)lx /= abs(lx);
          if(ly)ly /= abs(ly);
          if(dx[r]==lx&&dy[r]==ly)
              direct.push_back(r);
        }
        x = nx;
        y = ny;
      }
      REP(i,direct.size()-1){
        int dif = direct[i+1]-direct[i];
        if(dif==3) dif -= 4;
        if(dif==-3) dif+=4;
        diff.push_back(dif);
      }
      if(diff==t_diff&&length==t_length){
        cout<<j+1<<endl;
      }
      reverse(diff.begin(),diff.end());
      reverse(length.begin(),length.end());
      REP(i,diff.size()) if(abs(diff[i])==1) diff[i]*=-1;
      if(diff==t_diff&&length==t_length){
        cout<<j+1<<endl;
      }
    }
    cout<<"+++++"<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#define N 102

//バブルソートは安定しているので、それを基準に考える

struct inf{
  char form;
  int num;
};

struct inf ori[N];

void bubblesort(struct inf *a, int n){
  struct inf tmp;
  int i,j,side=0;

  for(i=0;i<n-1;i++){
    for(j=n-1;j>side;j--){
      if(a[j].num<a[j-1].num){
        tmp=a[j];
        a[j]=a[j-1];
        a[j-1]=tmp;
      }
    }
    side++;
  }
}

void selectionsort(struct inf *b, int n){
  struct inf tmp;
  int i,j,minj;

  for(i=0;i<n-1;i++){
    minj=i;
    for(j=i;j<n;j++){         //iはsideと同じ働き
      if(b[j].num<b[minj].num) minj=j;
    }
    tmp=b[i];
    b[i]=b[minj];
    b[minj]=tmp;
  }
}

int judge(struct inf *x, struct inf *y, int n){
  int i;

  for(i=0;i<n;i++){
    if(x[i].form!=y[i].form) return 0;
  }
  return 1;
}

void print(struct inf *x, struct inf *y, int n){
  int i,hantei;

  for(i=0;i<n-1;i++) printf("%c%d ",x[i].form,x[i].num);
  printf("%c%d\n",x[i].form,x[i].num);
  printf("Stable\n");

  for(i=0;i<n-1;i++) printf("%c%d ",y[i].form,y[i].num);
  printf("%c%d\n",y[i].form,y[i].num);

  hantei=judge(x,y,n);

  if(hantei==1) printf("Stable\n");
  else printf("Not stable\n");
}

int main(){
  struct inf a[N],b[N];
  int n,i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c%d",&ori[i].form,&ori[i].num);
    a[i]=b[i]=ori[i];
  }
  
  bubblesort(a,n);
  selectionsort(b,n);
  print(a,b,n);

  return 0;
}


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

using lint = long long;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<vector<T>>;
template <typename T> using VVV = vector<vector<vector<T>>>;
#define rep(i, n) for(int i = 0; i < int(n); i++)
#define repu(i, a, b, s) for(int i = int(a); i < int(b); i += int(s))
#define repd(i, a, b, s) for(int i = int(a); i > int(b); i += int(s))
#define endl "\n"
constexpr lint INF = 2e18;
constexpr lint MOD = 1e9 + 7;

void solve() {
    lint A, B;
    cin >> A >> B;

    string ans;
    if(A <= 8 and B <= 8) {
        ans = "Yay!";
    } else {
        ans = ":(";
    }
    cout << ans << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}

Measured memory_bytes: 3592
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( [ $ t : ty ] ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( [ $ t : ty ] ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( [ $ t ] ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let s = util::chars();

    let ans = s
        .windows(3)
        .map(|s| {
            let x = s[0] as i64 - '0' as i64;
            let y = s[1] as i64 - '0' as i64;
            let z = s[2] as i64 - '0' as i64;

            let n = 100 * x + 10 * y + z;

            (753 - n).abs()
        })
        .min()
        .unwrap();

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


Measured memory_bytes: 8572
s = input()
t = input()
l = [""]*26
m = list("abcdefghijklmnopqrstuvwxyz")

ans = ("Yes")
for i in range(len(s)):
    idx = m.index(s[i])
    if l[idx] == "":
        l[idx] = t[i]
    else:
        if l[idx] != t[i]:
            ans = "No"
            

        
n = []
for i in l:
    if i != "":
        if i in n:
            ans = "No"
        else:
            n.append(i)
        
        
print(ans)

Measured memory_bytes: 42224
import Text.Printf

main :: IO ()
main = do
    [a,b,angC] <- fmap (map read . words) getLine :: IO [Double]
    let radC = angC / 180 * pi
        c    = sqrt $ a^2 + b^2 - (2 * a * b * cos radC)
        s    = 0.5 * a * b * sin radC
        l    = a + b + c
        h    = s * 2 / a
    mapM_ (printf "%.5f\n") [s,l,h]


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

int main() {
  string s;
  cin >> s;
  bool ok = true;
  int cnt = 0;
  if(s[0] != 'A') ok = false;
  for(int i = 1; i < (int)s.size(); i++) {
    if(isupper(s[i])) {
      if(i == 1 || i == (int)s.size() - 1 || s[i] != 'C') ok = false;
      cnt++;
    }
  }
  if(cnt != 1) ok = false;
  
  if(ok) cout << "AC" << endl;
  else cout << "WA" << endl;
  return 0;
}

Measured memory_bytes: 3636
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


a, b, k = map(int, input().split())


set_a = set(make_divisors(a))
set_b = set(make_divisors(b))

both = list(set_a & set_b)
both.sort()

print(both[- k])

Measured memory_bytes: 9168
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 20 15:31:37 2019

@author: Yamazaki Kenichi
"""

N = int(input())
A = [list(map(int,input().split())) for i in range(N)]

ans = 0

for i in range(N):
    if (A[-1-i][0]+ans) % (A[-1-i][1]) ==0:
        ans+=0
    else:
        ans+=A[-1-i][1] - ((A[-1-i][0]+ans) % (A[-1-i][1]))
#        abs(A[-1-i][1] - (A[-1-i][0]+ans))
#    print(ans)
#    elif A[-1-i][1] > (A[-1-i][0]+ans):
#        ans+=A[-1-i][1] - (A[-1-i][0]+ans)
#    elif A[-1-i][1] < (A[-1-i][0]+ans):
#        ans+=(A[-1-i][0]+ans)-A[-1-i][1]
print(ans)
        


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

#define MAX 1000001
//#define MAX 100

set<int> primes;
bool is_prime[MAX];

/*
void print_set(set<int> s)
{
	set<int>::iterator it = s.begin();
	printf("set (");
	while (it != s.end())
	{
		printf(" %d", *it);
		++it;
	}
	printf(" )\n");
}
*/

int n;

signed main()
{
	rep(i,MAX) is_prime[i] = true;
	is_prime[1] = false;
	for (int i=2; i<MAX; i++)
	{
		if (is_prime[i])
		{
			primes.insert(i);
			for (int j=i*2; j<MAX; j+=i)
			{
				is_prime[j] = false;
			}
		}
	}

	while (true)
	{
		cin >> n;
		if (n == 0) break;
		int ans = 0;
		for (int i=2; i<=n/2; i++)
		{
			if (primes.find(i) != primes.end() && primes.find(n - i) != primes.end())
			{
				ans++;
			}
		}
		printf("%d\n", ans);
	}

	//print_set(primes);
	//printf("END\n");
}

Measured memory_bytes: 5824
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
 
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>
#include<iomanip>
 
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define mt(a,b,c) make_tuple(a,b,c)
#define rank qwertyuio
#define next dfghjk
#define plus fsghsf
#define minus ytryr
#define pb push_back
using namespace std;
 
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
 
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const ld eps = 1e-12;
const double pi = atan2(0, -1);
const int ABC = 26;
#define ent '\n'
ll fac[100007];
ll power(ll x, ll y) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % mod;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % mod; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % mod; 
    } 
    return res; 
} 
ll modInverse(ll n) 
{ 
    return power(n, mod-2); 
} 
  

ll nCrModPFermat(ll n, ll r) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
  
    return (fac[n]* modInverse(fac[r]) % mod * 
            modInverse(fac[n-r]) % mod) % mod; 
} 

//ll power2[100005];

int main(){
    string s,t;
    int a,b;
    string u;
    cin>>s>>t>>a>>b>>u;
    if(s==u){
        a--;
    }
    if(t==u){
        b--;
    }
    cout<<a<<" "<<b;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int count = 0;
  
  if (S.at(0) == '0' && S.at(1) != '0'){
    count += 10;
  }
  else if (S.at(0) == '1' && (S.at(1) == '0' || S.at(1) == '1' || S.at(1) == '2')){
    count += 10;
  }
           
  if (S.at(2) == '0' && S.at(3) != '0'){
    count += 20;
  }
  else if (S.at(2) == '1' && (S.at(3) == '0' || S.at(3) == '1' || S.at(3) == '2')){
    count += 20;
  }
           
  if (count == 30){
    cout << "AMBIGUOUS" << endl;
  }
  else if (count == 20){
    cout << "YYMM" << endl;
  }
  else if (count == 10){
    cout << "MMYY" << endl;
  }
  else {
    cout << "NA" << endl;
  }
}
  
 

Measured memory_bytes: 3548
program main
      implicit none
      integer :: a, b
      read *, a
      read *, b

      if (( a == 1 ) .or. ( b == 1 )) then
        if (( a == 2 ) .or. ( b == 2 )) then
          print *, '3'
        else if (( a == 3 ) .or. ( b == 3 )) then
          print *, '2'
        end if
      end if
      if (( a == 2 ) .or. ( b == 2 )) then
        if (( a == 3 ) .or. ( b == 3 )) then
          print *, '1'
        end if
      end if

end program main


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>
#include<cmath>
#include<set>
#include<queue>
#include<algorithm>
#include<climits>
#include<map>
#include<unordered_map>
#define ll long long

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

#define w(t) ll t,tt=1;	cin>>t;		while(t--)
#define ps(x,y) fixed<<setprecision(y)<<x
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ff first
#define ss second
#define pb push_back
#define mp make_pair

#define vi vector<int>
#define vll vector<ll>
#define mii map<ll,ll>
#define umii unordered_map<ll,ll>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>

#define mod 1e9+7
#define inf 1e18

#define lln ll n; cin>>n
#define intn int n; cin>>n
#define YES cout<<"YES"
#define NO cout<<"NO"
#define strr    string str; cin>>str;
#define strn   n=str.length()
#define fr(a,n) for(ll i=a;i<n;i++)
#define loop for(ll i=0;i<n;i++)

using namespace std;

void solve (){
    intn;
    strr;
    int R=count(str.begin(),str.end(),'R');
    cout<<count(str.begin(),str.begin()+R,'W');
}

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


Measured memory_bytes: 3720
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
const long long mod = 1e9 + 7;
typedef long long ll;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,VI(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp
// operator << (cout,a);
// chmin(min,a)
 


int main() {
  ll n,k,m,x=0,y=0,z = 0,h=0,w=0,ans=0,sum = 1, Max = -1, Min = 3e9+1;
  string u;
  bool ok=true;
  cin >> n;
  VL a(n);
  map<ll, ll> mp;
  rep(i,n){
    cin >> x;
    auto itr = mp.find(x);
    if(itr != mp.end()){
      itr->second++;
    }
    else{
      mp.insert(make_pair(x,1));
    }
  }
  for( auto i = mp.rbegin(); i != mp.rend();i++ ) { 
    if(i->second/2 >= 2 && h > 0 ){
      w = i->first;
    }
    else if(i->second/2 >= 2 && h==0){
      pri(i->first*i->first);
      return 0;
    } 
    else if(i->second/2 >= 1 && h>0){
      w = i->first;
    }
    else if(i->second/2 >= 1){
      h = i->first;
    }

    if(w>0){
      pri(h*w);
      return 0;
    }
  }
  pri(0);
  return 0;
}

Measured memory_bytes: 7296
#include <stdio.h>

int main() {
    char arr[20];
    scanf ("%[^\n]", arr);
    for (int i = 0; i < 19; i++) {
        if (i == 5 || i == 13) {
            printf(" ");
            continue;
        }
    printf("%c", arr[i]);
    }
    return 0;
}

Measured memory_bytes: 1600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define cans cout << ans << endl
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
typedef long long ll;


int main(){
    int n,k;
    cin >> n >> k;
    ll ans = 0;
    if(k%2){
        ll now = n/k;
        ans = now*now*now;
    }
    else{
        ll now1 = n/k;
        ll now2 = 0;
        for(int i=1; i<=n; i++){
            if(i%k==k/2) now2++;
        }
        ans = now1*now1*now1 + now2*now2*now2;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

const int maxn = 1e5 + 10;

int vis[maxn], dep[maxn];

vector<int> edge[maxn];
vector<pair<int, int> > ans;

bool dfs(int u, int pre)
{
    int s = 0;
    vis[u] = 1, dep[u] = dep[pre] + 1;
    for(auto v : edge[u])
    {
        if(!vis[v]) s ^= dfs(v, u);
        else if(dep[v] > dep[u])
        {
            ans.push_back({u, v});
            s ^= 1;
        }
    }
    if(s && pre) ans.push_back({u, pre});
    else if(pre) ans.push_back({pre, u});
    return s ^ 1;
}

int main()
{
    int n, m, u, v;
    scanf("%d%d", &n, &m);
    while(m --)
    {
        scanf("%d%d", &u, &v);
        edge[u].push_back(v);
        edge[v].push_back(u);
    }
    if(!dfs(1, 0)) return puts("-1"), 0;
    for(auto i : ans) printf("%d %d\n", i.first, i.second);
    return 0;
}


Measured memory_bytes: 17908
import java.util.Scanner;
 
public class Main {
    static Scanner sc = new Scanner(System.in);
     
    static boolean search(String tar , String str){//２つの引数の文字列で看板が作れるかどうか判定するクラスメソッド
        boolean f = false;
        for(int j=0;j<str.length();j++){
            if(tar.equals(str))return true;
            if(tar.charAt(0)==str.charAt(j)){
                int cnt=0;
                for(int i=j+1;i<str.length();i++){
                    cnt++;
                    if(str.length()<j+cnt)continue;
                    if(tar.charAt(1)==str.charAt(i)){
                        if((j+tar.length()-1*cnt)>str.length())break;//
                        for(int k=2;k<tar.length();k++){
                            if(j+k*cnt>=str.length()){f=false;break;}//
                            if(tar.charAt(k)==str.charAt(j+k*cnt))f = true;
                            else {
                                f = false;
                                break;
                            }
                        }
                        if(f==true) return f;
                    }
                }
            }
        }       
        return f;
    }
     
    void doIt(){//クラス変数scに対しての操作を決めるメソッド
        int n = sc.nextInt();
        int ans = 0;
        String tar = sc.next();
        for(int i=0;i<n;++i){
            String s = sc.next();
            if(search(tar,s))ans++;
        }
        System.out.println(ans);
    }
 
    public static void main(String[] args) {
        new Main().doIt();
    }
 
}

Measured memory_bytes: 20744
line = gets.chomp.split
people_count = line[0].to_i
point = line[1].to_i
games_count = line[2].to_i
pmb = point - games_count
peoples = Array.new(people_count, pmb)
games_count.times do
	peoples[gets.chomp.to_i - 1] += 1
end
people_count.times do |i|
	if peoples[i] <= 0
		puts "No"
	else
		puts "Yes"
	end
end

Measured memory_bytes: 3196
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<cctype>

#define DBG cout << '!' << endl;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

ll gcd(ll a,ll b)
{
	if(a<b)
	{
		ll tmp = a;a = b;b = tmp;
	}
	if(b == 0)
		return a;
	else
		return gcd(b,a%b);
}

ll f(ll a,ll b)
{
	ll ret = gcd(a,b);
	
	return a/ret*b;
}

int main()
{
	int n;
	cin >> n;
	
	ll num[n];
	cin >> num[0];
	ll ret = num[0];
	
	for(int i = 1;i < n;i++)
	{
		cin >> num[i];
		ret = f(ret,num[i]);
	}
	
	cout << ret << endl;
	
	return 0;
}

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

using namespace std;

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

   

    if (s[0]==s[s.size()-1] xor s.size()%2==0){
        cout << "Second" << endl;
    } 

    else{
        cout << "First" << endl;
    }


    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

template<typename F>
static inline constexpr decltype(auto) fix(F&& f) noexcept {
  return [f = std::forward<F>(f)](auto&&... args) {
    return f(f, std::forward<decltype(args)>(args)...);
  };
}

int main() {
  const i64 N = [](){ i64 n; cin >> n; return n; }();
  const vector<i64> A = [n = N](){ vector<i64> a(n); for(auto& x: a) cin >> x; return std::move(a); }();
  const i64 ans = fix(
      [N, &A](auto f, i64 l, i64 r, i64 left, i64 right) -> i64 {
        if(l > r) return 0ll;
        i64 res = 1e18;
        for(int i = l;i <= r;i++) {
          res = min(res, f(f, l, i - 1, left, left + right) + f(f, i + 1, r, left + right, right) + A[i] * (left + right));
        }
        return res;
      }
      )(1ll, N - 2ll, 1ll, 1ll) + A.front() + A.back();
  
  cout << ans << endl;
}


Measured memory_bytes: 256
import sys
import math

n, k = map(int, input().split())
a = list(map(int, input().split()))


def ok(x):
    b = [i % x for i in a]
    b.sort(reverse=True)
    t = int(sum(b) / x)
    if t == 0:
        return True
    return True if sum(b[t:]) <= k else False


s = sum(a)
sqs = int(math.sqrt(s))
ans = 1
for x in range(1, sqs + 1):
    if s % x != 0:
        continue
    if ok(x):
        ans = max(ans, x)
    if ok(int(s / x)):
        ans = max(ans, int(s / x))

print(ans)


Measured memory_bytes: 3188
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

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

  //youtube動画の解法（感）

  ll N ; cin >> N;
  vector<ll> A;
  rep(i,N){
    ll inp; cin >> inp;
    A.pb(inp);
  }

  ll l =2, r = 2;
  ll a,b ;

  for(ll i = A.size()-1; i>=0; i--){
    a = l/A[i]; if(l%A[i] !=0) a++; a*=A[i];
    b = r/A[i]; b*=A[i];

    if(a > b){
      cout << "-1" << endl;
      return 0;
    }
    l = a;
    r = b+(A[i]-1);
  }

  cout << l << " " << r << endl;
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 1528
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
using namespace std;
//using namespace boost::multiprecision;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}


int main(){
  
  int n;
  cin>>n;
  int a[n];
  REP(i,n){
    cin>>a[i];
  }
  int rest = 0;
  int now = 1;
  REP(i,n){
    if(a[i] == now){
      rest++;
      now++;
    }else{
      ;
    }
  }
  if(rest == 0){
    cout<<-1<<endl;
    return 0;
  }
  int ans = n - rest;
  cout<<ans<<endl;
  return 0; 
}


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

Measured memory_bytes: 1028
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int N,a,b,c,d;
      cin >> N ;
     a=N/1000;
      b=(N-1000*a)/100;
      c=(N-1000*a-100*b)/10;
      d=(N-1000*a-100*b-10*c);
      if (a==b && b==c ) {
        cout << "Yes" << endl;
      }
      else if(b==c && c==d){
        cout << "Yes" << endl;
      }
      else{
        cout << "No" << endl;
      }
    }

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace ConsoleApplication2
{
    class Program
    {

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int q = int.Parse(input[1]);

            List<int>[] tree = new List<int>[n];
            for (int i = 0; i < n; i++) tree[i] = new List<int>();

            for (int i = 0; i < n - 1; i++)
            {
                input = Console.ReadLine().Split(' ');
                int a = int.Parse(input[0]);
                int b = int.Parse(input[1]);
                tree[a - 1].Add(b - 1);
                tree[b - 1].Add(a - 1);
            }

            int[] value = new int[n];
            for (int i = 0; i < n; i++) value[i] = 0;

            //各頂点に格納
            for (int i = 0; i < q; i++)
            {
                input = Console.ReadLine().Split(' ');
                int p = int.Parse(input[0]);
                int x = int.Parse(input[1]);
                value[p - 1] += x;
            }
            int[] counter = new int[n];


            count(-1, 0, 0, counter, value, tree);

            Console.WriteLine(string.Join(" ", counter));

        }

        public static void count(int parent,int me,int pval, int[] counter, int[] value, List<int>[] tree)
        {
            counter[me] = value[me] + pval;
            foreach (int child in tree[me])
            {
                if (child != parent)
                {
                    count(me, child, counter[me], counter, value, tree);
                }
            }

        }

    }
}

Measured memory_bytes: 76676
using System;
using static System.Console;
public class Hello{
    public static void Main(){
//        string[] a = ReadLine().Split(' ');
//        int x = int.Parse(a[0]);
//        int y = int.Parse(a[1]);
//        int z = int.Parse(a[2]);
        string b = ReadLine();
        int count = 0;
        if(b[0] == '1'){ count++; }
        if(b[1] == '1'){ count++; }
        if(b[2] == '1'){ count++; }
        WriteLine(count);
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mpr make_pair
#define mt make_tuple
 
using namespace std;
 
const ll N = 3010;
const ll mod = 1e9 + 7;
ll power(ll x, ll   y, ll p){ ll res = 1; x = x % p;while (y > 0){ if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x) % p;} return res; }
double dp[N][N];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    double res = 0.0;
    double prob[N];
    cin>>n;
    for(int i=1;i<=n;i++)    cin>>prob[i];
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1.0;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=i;j++)
            dp[i][j] = (dp[i-1][j]*(1-prob[i])) + ((j > 0) ? dp[i-1][j-1]*(prob[i]) : 0.0);
    }
    for(int i=n;i>n/2;i--)  res += dp[n][i];
    cout<<setprecision(12)<<res<<endl;
    return 0;
}

Measured memory_bytes: 71040
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;

int main ()
{
	int n,k, ans = 0;
	vi snukes;
	cin >> n >> k;
	snukes.resize(n+1, 0);
	for(int i = 0; i < k; i++)
	{
		int d;
		cin >> d;
		for (int j = 0; j < d; j++)
		{
			int x;
			cin >> x;
			snukes[x]++;			
		}
	}
	for(int i = 1; i < snukes.size(); i++)
	{
		if(snukes[i] == 0)
			ans++;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1000000007;

int main() {
  int N;
  cin >> N;
  vector<int> h(N);
  for (int i=0; i<N; i++) cin >> h.at(i);
  vector<int> dp(N);
  dp.at(0) = 0;
  for (int i=1; i<N; i++) {
    if (i==1) dp.at(i) = abs(h.at(i-1)-h.at(i));
    else dp.at(i) = min(abs(h.at(i-1)-h.at(i))+dp.at(i-1), abs(h.at(i-2)-h.at(i))+dp.at(i-2));
  }
  cout << dp.at(N-1) << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B;
  cin >> N >> A >> B;
  
  int plan1 = N * A;
  int plan2 = B;
 
  if (plan1 > plan2) {
    cout << plan2 << endl;
  } else {
    cout << plan1 << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#define ll long long
int main(){
int n;
  std::cin >> n;
  std::string s;
  std::cin >> s;
  int tr=0,tw=0;
  for(int i=0;i<n;i++){
    if(s[i]=='W')
         tw++;
    else
         tr++;
  }
if(tr==n || tw==n)
        std::cout << "0" << std::endl;
else{
  int t=0;
  for(int i=0;i<tr;i++){
    if(s[i]=='W')
        t++;
  }
  std::cout << t << std::endl;
}

 return 0;
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll ans = 0;
    int n;
    cin >> n;
    vector<int> a(n + 1);
    vector<int> b(n);
    for(int i = 0; i < n + 1; i++)
    {
        cin >> a[i];
    }
    for(int i = 0; i < n; i++)
    {
        cin >> b[i];
    }
    for(int i = 0; i < n; i++)
    {
        ll mini = min(a[i], b[i]);
        a[i] -= mini;
        b[i] -= mini;
        ans += mini;
        mini = min(a[i + 1], b[i]);
        a[i + 1] -= mini;
        b[i] -= mini;
        ans += mini;
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
#define all(x) (x).begin(),(x).end()
using namespace std;
vector<int> v[26];
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a*b/gcd(a,b);
}
signed main(){
	string s,t;
	cin>>s>>t;
	f(i,s.size()){
		v[s[i]-'a'].push_back(i);
	}
	int z=-1,ans=0,vz;
	f(i,t.size()){
		vz=(int)(upper_bound(v[t[i]-'a'].begin(),v[t[i]-'a'].end(),z)-v[t[i]-'a'].begin());
		if(vz==(int)v[t[i]-'a'].size())ans++;
		if(v[t[i]-'a'].size()==0){
			puts("-1");
			return 0;
		}
		z=v[t[i]-'a'][vz%(int)(v[t[i]-'a'].size())];
	}
	cout<<ans*(int)s.size()+z+1<<endl;
}


Measured memory_bytes: 1724