akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template<typename Head> void dump(Head&& head) { cerr << head; dump(); }
template<typename Head, typename... Tail> void dump(Head&& head, Tail&&... tail) { cerr << head << ", "; dump(forward<Tail>(tail)...); }
#define debug(...) do {cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; dump(__VA_ARGS__); } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////

const ll inf = 1LL<<60;

ll f(ll n) {
  ll ret = 0;
  while(n > 0) {
    n %= __builtin_popcountll(n);
    ret++;
  }
  return ret;
}

int main()
{
  ll n; cin >> n;
  string s; cin >> s;
  reverse(s.begin(), s.end());

  ll d = 0;
  for (int i=0; i<n; i++) {
    if (s[i] == '1') d++;
  }

  ll a = d - 1;
  ll b = d;
  ll c = d + 1;
  vector<ll> x(n+1, 1);
  vector<ll> y(n+1, 1);
  vector<ll> z(n+1, 1);
  rep(i, n) {
    if (a > 0) x[i+1] = x[i]*2 % a;
    if (b > 0) y[i+1] = y[i]*2 % b;
    if (c > 0) z[i+1] = z[i]*2 % c;
  }

  ll xx = 0;
  ll yy = 0;
  ll zz = 0;
  rep(i, n) {
    if (s[i] == '1') {
      if (a > 0) (xx += x[i]) %= a;
      if (b > 0) (yy += y[i]) %= b;
      if (c > 0) (zz += z[i]) %= c;
    }
  }

  for (int i=n-1; i>=0; i--) {
    if (s[i] == '1') {
      if (a <= 0) {
        cout << 0 << endl;
        continue;
      } else {
        ll ans = f((xx + a - x[i]) % a);
        cout << ans + 1 << endl;
      }
    } else {
      ll ans = f((zz + z[i]) % c);
      cout << ans + 1 << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 8336
use std::io::stdin;

struct Dsu{
    par: Vec<usize>,
    rank: Vec<usize>,
}

impl Dsu {
    fn init(n: usize) -> Dsu {
        let mut dsu = Dsu{ 
            par: Vec::with_capacity(n),
            rank: Vec::with_capacity(n),
        };
        for i in 0..n {
            dsu.par.push(i);
            dsu.rank.push(0);
        }
        dsu
    }

    fn root(&mut self, n: usize) -> usize {
        if self.par[n] == n {
            n
        } else {
            let n = n;
            let r = self.root(self.par[n]);
            self.par[n] = r;
            r
        }
    }

    fn same(&mut self, x: usize, y: usize) -> bool {
        self.root(x) == self.root(y)
    }

    fn unite(&mut self, x: usize, y: usize) {
        let x = self.root(x);
        let y = self.root(y);
        if x == y {
            return
        } 

        if self.rank[x] < self.rank[y] {
            self.par[x] = y;
        } else {
            self.par[y] = x;
        }
    }
}


fn main() {
    // 連結なグラフにするための最小の追加辺数を求める
    // -> X個の連結な部分グラフがある場合、X-1個になる

    // 連結成分を扱うのに UNION-FIND という構造が良い
    
    let mut nm = String::new();
    stdin().read_line(&mut nm).unwrap();
    let mut nm = nm.trim().split_whitespace();
    let n = nm.next().unwrap();
    let n: usize = n.parse().unwrap();
    let mut dsu = Dsu::init(n);

    let m = nm.next().unwrap();
    let m: usize = m.parse().unwrap();

    for _ in 0..m {
        let mut ab = String::new();
        stdin().read_line(&mut ab).unwrap();
        let mut ab = ab.split_ascii_whitespace();
        let a = ab.next().unwrap().parse::<usize>().unwrap() - 1;
        let b = ab.next().unwrap().parse::<usize>().unwrap() - 1;
        dsu.unite(a, b);
    }

    let mut cnt = 0;
    // 連結グラフの個数を数える（同一グループの木の数）
    for i in 0..n {
        cnt += if dsu.root(i) == i { 1 } else { 0 }
    }
    
    println!(
        "{}", cnt - 1
    )
}


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

template <typename T>
inline void Read(T &x)
{
    x=0;T f=1;char a=getchar();
    while(a<'0'||'9'<a) {if (a=='-') f=-f; a=getchar();}
    while('0'<=a&&a<='9') x=x*10+(a-'0'),a=getchar();
    x*=f;
}

struct data{
	long long v,t;
}ai[100010];

bool cmp(data a,data b)
{
	return a.v<b.v;
}

long long N,M,C,ans;


int main()
{
    Read(N),Read(M);
    for(int i=1;i<=N;i++) Read(ai[i].v),Read(ai[i].t);
    sort(ai+1,ai+N+1,cmp);
    for(int i=1;i<=N;i++)
    {
    	if (M<=0) break;
    	if (M>=ai[i].t)
    	{
    		M-=ai[i].t;
    		ans+=ai[i].t*ai[i].v;
		}
		else if (M<ai[i].t)
		{
			ans+=M*ai[i].v;
			M=0;
		}
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int main()
{
    int n;
    int ans = 0;
    cin>>n;
    if(n == 1) {
        cout << 0;
        exit(0);
    }
    if(n == 2) {
        cout << 1;
        exit(0);
    }
    for (int i=1;i<n-1;i++)
    {
        for (int j=1;j<n-1;j++)
        {
            if(n <= i*j){
                break;
            }
            ans++;
        }
    }
    cout << ans+2;
}


Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            while ((line = br.readLine()) != null&&line.length()!=0) {
            	String[] str=line.split(" ");
            	int a=Integer.parseInt(str[0]);
            	int b=Integer.parseInt(str[1]);

            	System.out.println(a*b+" "+(a*2+b*2));
            	break;
            }
         }
	}

}

Measured memory_bytes: 24116
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int main(){

  int a,b,c;cin>>a>>b>>c;

  if(a==5&&b==5&&c==7)out("YES")
  else if(a==5&&b==7&&c==5)out("YES")
  else if(a==7&&b==5&&c==5)out("YES")
  else out("NO")

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<utility>
using namespace std;
int main()
{
	int n, t;
	cin >> n >> t;
	pair<int, int> tmp,val;
	cin >> val.first >> val.second;
	for (int i = 1; i < n; i++) {
		cin >> tmp.first >> tmp.second;
		if (tmp.second <= t) {
			if (val.first > tmp.first) {
				val = tmp;
			}
		}
	}
	if (t >= val.second) {
		cout << val.first << endl;
	}
	else {
		cout << "TLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string s,t;
  cin>>s;
  cin>>t;
  int x=s.size();
  string y=t.erase(x);
  if(s==y){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
}

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


const ll INF = 1e18;

int main() {
  ll n, t;
  cin >> n >> t;
  vector<P> v(n);
  rep(i,n){
    ll a1,b1;
    cin>>a1>>b1;
    v[i]=make_pair(a1,b1);
  }
  sort(v.begin(),v.end());
  ll dp[n+5][t+3000];
  dp[0][0]=0;
  ll ans=0;

  rep(i,n){
    rep(j,t){
      dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
      dp[i+1][j+v[i].first]=max(dp[i+1][j+v[i].first],dp[i][j]+v[i].second);
    }
    ans=max(ans,dp[i][t-1]+v[i].second);
  }
cout<<ans;

}


Measured memory_bytes: 144240
using System;

namespace ABC_168_A_C_sharp_ver
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            switch(N%10)
            {
                case 2:
                case 4:
                case 5:
                case 7:
                case 9:
                    Console.WriteLine("hon");
                    break;
                case 0:
                case 1:
                case 6:
                case 8:
                    Console.WriteLine("pon");
                    break;
                default:
                    Console.WriteLine("bon");
                    break;

            }
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 17500
import java.util.Scanner;

public class Main {
	int lengthOfLongestCommonSubsequence(String s1, String s2)

	{
		int m = s1.length();
		int n = s2.length();
		int[][]lcs = new int[m+1][n+1];
		
		
		for(int i = 1 ; i<m + 1; i ++) {
			for(int j=1; j<n+1; j++) {
				char a = s1.charAt(i-1);
				char b = s2.charAt(j-1);
						
				if (a != b) {
					lcs[i][j] = max(lcs[i-1][j],lcs[i][j-1]);
				}
				else {
					lcs[i][j] = 1 + lcs[i-1][j-1];
				}
				
				
			}
		}
		return lcs[m][n];
	}
	int max(int a, int b)
	{
		return (a > b) ? a : b;
	}
	int min(int a, int b) {
		return (a < b) ? b : a;
	}
	public static void main(String[] args)
	{
		Main lcsobject = new Main();
		Scanner in = new Scanner(System.in);
		int q = in.nextInt();
		in.nextLine();
		
		for(int i = 0; i < q; i ++) { // X
			String s1 = in.nextLine();
			String s2 = in.nextLine();
			System.out.println(lcsobject.lengthOfLongestCommonSubsequence(s1, s2));
			
			
		
		}
	
		in.close();
	}
}




Measured memory_bytes: 64076
#include<iostream>
#include<stack>
#include<string>
using namespace std;

string str;

bool is_balance(){

  stack<char> s;

  for(int i=0 ; str[i] != '.' ; i++){
    if(str[i] == '(' || str[i] == '['){
      s.push(str[i]);
    }else if(str[i] == ')'){
      if(s.empty() || s.top() != '('){
	return false;
      }
      s.pop();
    }else if(str[i] == ']'){
      if(s.empty() || s.top() != '['){
	return false;
      }
      s.pop();
    }
  }

  if(s.empty()){
    return true;
  }

  return false;
  
}
int main(){

  while(1){

    getline(cin,str);

    if(str == ".")break;
    
    if(is_balance()){
      cout <<"yes"<<endl;
    }else{
      cout <<"no"<<endl;
    }
    
  }


  return 0;
}

Measured memory_bytes: 1176
import java.util.*;

class Main {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        
        int sum_a = 0;
        for (int i=0; i<M; i++) {
        	int a = sc.nextInt();
        	sum_a += a;
        }
        
        if (sum_a <= N)
        	System.out.println(N-sum_a);
        else
        	System.out.println(-1);
        	

	}

}

Measured memory_bytes: 46400
n = int(input())

def Digits_sum(a):
    a_s = str(a)
    sum_ = 0
    for i in a_s:
        sum_ += int(i)
    return sum_

ans = 10000

for i in range(1,(n//2)+1):
    A = i
    B = n-A
    sum_ = Digits_sum(A)+Digits_sum(B)
    ans = min(ans,sum_)
print(ans)

Measured memory_bytes: 8980
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int n;
    cin >> n;
    
    vec<string> S(n);
    map<char,int> ans;
    rep(i, n) {
        map<char,int> mp;
        cin >> S[i];
        sort(all(S[i]));
        for(auto e:S[i]){
            ++mp[e];
        }
        if(i==0) ans = mp;
        else {
            rep(i,26){
                ans['a'+i] = min(ans['a'+i],mp['a'+i]);
            }
        }
    }

    for(auto [f,s]:ans){
        rep(_,s){
            cout << f;
        }
    }
    cout << '\n';
}


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

void printarr(int arr[], int top) {
   for(int i = 0; i < top - 1; i++) {
      cout << arr[i] << " ";
   }
   cout << arr[top - 1] << endl;
}

int main() {
   int top;
   cin >> top;
   int arr[top], tmp;
   
   for(int i = 0; i < top; i++) {
      cin >> arr[i];
   }
   
   printarr(arr, top);
   
   for(int i = 1; i < top; i++) {
      tmp = arr[i];
      int j = i;
      
      while(j > 0 && tmp < arr[j - 1]) {
         arr[j] = arr[j - 1];
         j--;
      }
         
      arr[j] = tmp;
      printarr(arr, top);
   }
   
   return 0;
}


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

using namespace std;

template < class BidirectionalIterator >
bool next_combination( BidirectionalIterator first1,
	BidirectionalIterator last1,
	BidirectionalIterator first2,
	BidirectionalIterator last2 ) {
	if( (first1 == last1) || (first2 == last2) ) {
		return false;
	}
	BidirectionalIterator m1 = last1;
	BidirectionalIterator m2 = last2; --m2;
	while( --m1 != first1 && !(*m1 < *m2) ) {
	}
	bool result = (m1 == first1) && !(*first1 < *m2);
	if( !result ) {
		// ???
		while( first2 != m2 && !(*m1 < *first2) ) {
			++first2;
		}
		first1 = m1;
		std::iter_swap( first1, first2 );
		++first1;
		++first2;
	}
	if( (first1 != last1) && (first2 != last2) ) {
		// ???
		m1 = last1; m2 = first2;
		while( (m1 != first1) && (m2 != last2) ) {
			std::iter_swap( --m1, m2 );
			++m2;
		}
		// ??¢
		std::reverse( first1, m1 );
		std::reverse( first1, last1 );
		std::reverse( m2, last2 );
		std::reverse( first2, last2 );
	}
	return !result;
}

template < class BidirectionalIterator >
bool next_combination( BidirectionalIterator first,
	BidirectionalIterator middle,
	BidirectionalIterator last ) {
	return next_combination( first, middle, middle, last );
}

int main() {
	long long int N, S;
	while( cin >> N >> S) {
		vector<long long int>D{ 0,1,2,3,4,5,6,7,8,9 };

		long long int ans = 0;
		do {
			vector<long long int>D2;
			copy( D.begin(), D.begin() + N, back_inserter( D2 ) );
			do {
				long long int sum = 0;
				for( size_t i = 0; i < N; i++ ) {
					sum += (i + 1)*D2[i];
				}
				if( sum == S ) {
					ans++;
				}
			} while( next_permutation( D2.begin(), D2.end() ) );
		} while( next_combination( D.begin(), D.begin() + N, D.end() ) );
		cout << ans << endl;
	}
}

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

int main(){
	int n;
	cin >> n;
	vector<int> hidari(n);
	vector<int> migi(n);
	rep(i,n) cin >> hidari[i] >> migi[i];
	vector<int> zoro(n);
	rep(i,n){
		if(hidari[i] == migi[i]) zoro[i] = 1;
	}
	int counts = 0;
	// rep(i,n) cout << zoro[i] << endl;
	rep(i,n){
		if(zoro[i] == 1 && zoro[i+1] == 1 && zoro[i+2] == 1) counts++;
	}
	if(counts > 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

// cout << fixed << setprecision(15) <<  << endl;

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

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  vector<int> H(N+1);
  for(int i=0;i<N;i++){
    cin >> L.at(i);
  }
  H.at(0) = 0;
  H.at(1) = abs(L.at(1)-L.at(0));
  if(N>2){
    for(int k=3;k<N+1;k++){
      H.at(k-1) = min(H.at(k-2)+abs(L.at(k-1)-L.at(k-2)),H.at(k-3)+abs(L.at(k-1)-L.at(k-3)));
    }
  }
  
  cout << H.at(N-1) <<endl;
}


Measured memory_bytes: 1024
// #pragma GCC optimize ("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>

using namespace std;
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

// #define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define zero(a) memset(a,0,sizeof(a))

// #define int ll

const ll INF = 1e18;
const ld PI = 4*atan((ld)1);
const int MOD = 1000000007; // 998244353

int n;
vector<int> v(22),c(22);

ll ans;

void solve(int pos,ll val){
	if(pos==n) ans = max(ans,val);
	else{
		for(int i=0;i<2;i++){
			solve(pos+1,val+i*v[pos]-i*c[pos]);
		}
	}
	return ;
}

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	for(int i=0;i<n;i++) cin >> v[i];
	for(int i=0;i<n;i++) cin >> c[i];
	ans = 0;
	solve(0,0);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T> int size(const T &x) { return x.size(); }
#define rep(i,a,b) for (__typeof(a) i=(a); i<(b); ++i)
#define iter(it,c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
const int INF = 2147483647;

int main() {
    string s;
    cin >> s;
    // ll cnt = 1;
    // map<string,vii> res;
    // rep(i,0,size(s)) {
    //     rep(j,i,size(s)) {
    //         string here = s.substr(i, j-i+1);
    //         string tmp = here;
    //         reverse(tmp.begin(), tmp.end());
    //         // if (here == tmp) {
    //         //
    //         // } else {
    //         //     cnt++;
    //         // }
    //         // cout << here << endl;
    //         // cout <<  << endl;
    //         res[s.substr(0,i) + tmp + s.substr(j+1)].push_back(ii(i,j));
    //     }
    // }
    // cout << size(res) << endl;
    // iter(it,res) {
    //     cout << it->first << ": ";
    //     iter(jt,it->second) {
    //         cout << jt->first << "," << jt->second << " ";
    //     }
    //     cout << endl;
    // }
    // cout << cnt << endl;

    map<char,int> seen;
    ll cnt = 1;
    rep(i,0,size(s)) {
        iter(it,seen) {
            if (s[i] != it->first) {
                cnt += it->second;
            }
        }
        seen[s[i]]++;
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 640
(n,), s, (q,), t = $<.map {|s| s.split.map &:to_i }
s.sort!

# p t.count {|y| s.bsearch {|x| y <=> x } }

p t.count {|y|
  l, u = 0, n
  while l < u
    m = (l + u) / 2
    case y <=> s[m]
    when -1 then u = m
    when  0 then l = u = m
    when  1 then l = m + 1
    end
  end
  y == s[l]
}



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

using namespace std;
using ll = long long;

int main() {
	ll N, K;
	cin >> N >> K;
	vector<ll> A(N), F(N);
	for(auto&& v : A) cin >> v;
	for(auto&& v : F) cin >> v;
	
	sort(A.begin(), A.end(), greater<ll>());
	sort(F.begin(), F.end());
	
	ll left = -1;
	ll right = 1145141919810364364;
	
	while(right-left > 1) {
		ll mid = left + (right - left) / 2;
		
		// 各選手の食事時間をmid以下にするには、xを修行回数とすると
		//     (a[i] - x) * f[i] <= mid
		// なので、
		//     (a[i] * f[i]) - (x * f[i]) <= mid
		//     x * f[i] >= (a[i] * f[i]) - mid
		//     x >= a[i] - (mid / f[i])
		// である必要がある。
		// 全選手の修行回数xの合計がk以下ならば、最大時間midは実現可能であると言える。
		
		ll count = 0;
		for(int i=0; i<N; i++) {
			count += max(A[i] - (mid / F[i]), 0LL);
		}
		
		// k以下の修行回数で最大値をmidにできるか？
		
		if(count <= K) right = mid;
		else left = mid;
	}
	
	cout << right << endl;
	
	return 0;
}


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

ll gcd(ll a,ll b){
    if(b>a) 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;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t =rep_jijo(n,x/2);
        return t*t%mod;
  }
  return n*rep_jijo(n,x-1)%mod;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long INF =1LL << 60;
ll N;
ll h[100100];
//DP テーブル
ll dp[100100];

int main() {
   ll N,K; 
   cin >> N>>K;
   rep(i,N){
       cin>>h[i];
   }

// DP テーブル全体を初期化 (最小化問題なので INF に初期化)
for (int i = 0; i < 100100; ++i) {
    dp[i] = INF;
    }

// 初期条件
dp[0] = 0;

// ループ
for (ll i = 0; i < N; ++i) {

        for(ll j=1;j<=K;j++){
         chmin(dp[i+j], dp[i] + abs(h[i]-h[i+j]));
    
}}
    
// 解を得て出力
cout << dp[N-1] << endl;
return 0 ;

}



Measured memory_bytes: 1792
D=int(input())                                          #コンテの日数
c=list(map(int,input().split()))                        #26タイプ(AAC~AZC)のコンテストの満足度低下度
s=[list(map(int,input().split())) for _ in range(D)]    #s[d][i]...d(1<=d<=D)日目にi(1<=i<=26)番目のコンテストを行った時の満足度上昇
#types=[int(input()) for _ in range(D)]                  #コンテタイプ(1~26)
#満足度低下はΣ(1<=i<=26)ci*(d-last(d,i))                  #なおlast(d,i)=d日目以前に最後にタイプiのコンテストをやった日にち(ない場合0)
#よって満足度はs[d][i]-Σ(1<=i<=26)ci*(d-last(d,i))
#i日目のスコアはmax(10^6+s[d][i]-Σ(1<=i<=26)ci*(d-last(d,i)),0)
#last=[0]*26                                             #typeごとに、最後に使われた日にちを記録するよ
typ=0
ans=0
#greedyに最大とりまーす
for i in range(D):
    print(i%26+1)


Measured memory_bytes: 67932
//ysh_gpta
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;


#define bit(x,i) (x&(1<<i))  //select the bit of position i of x
#define IN(i,l,r) (l<i&&i<r)   //the next for are for checking bound
#define LINR(i,l,r) (l<=i&&i<=r)
#define LIN(i,l,r) (l<=i&&i<r)
#define INR(i,l,r) (l<i&&i<=r)


#define repf(i,L,R) for (int i = L; i < R; i++) //next four are for "for loops"
#define repfe(i,L,R) for (int i = L; i <= R; i++)
#define repb(i,L,R) for (int i = L; i > R; i--)
#define repbe(i,L,R) for (int i = L; i >= R; i--)


typedef long long ll;
#define cerr if(false)cerr
#define vb vector<bool>
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define mkp make_pair
#define pb push_back
#define INF 1000000000000000
#define MOD 1000000007
#define ff first
#define ss second


#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define watch(x) cerr << (#x) << " is " << (x) << endl;
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


ll gcd( ll a, ll b ){if(b==0) return a; else return gcd( b, a%b );}
ll ncr(ll n,ll r){ll ans=1;r=min(r,n-r);for (int i=1;i<=r;i++){ans*=(n-r+i);ans/=i;}return ans;}


vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};


int main(){
    FastIO
    string k;
    cin>>k;
    ll d;
    cin>>d;
    vvi dp(d,vi(2));
    dp[0][0] = 1;
    repf(where,0,k.length()){
        vvi new_dp(d,vi(2));
        repf(sum,0,d){
            for(bool sm_already : {false,true}){
                repf(digit,0,10){
                    if(digit>k[where]-'0' && !sm_already) break;
                    new_dp[(sum+digit)%d][sm_already || digit<k[where]-'0'] += dp[sum][sm_already];
                    new_dp[(sum+digit)%d][sm_already || digit<k[where]-'0'] %= MOD;
                }
            }
        }
        dp = new_dp;
    }
    ll ans = (dp[0][0] + dp[0][1])%MOD;
    ans--;
    if(ans==-1)
    ans = MOD-1;
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
import Control.Applicative ((<$>))
import Control.Monad (replicateM)

main :: IO ()
main = do
  n <- readLn
  solve <$> replicateM n (map read <$> words <$> getLine) >>= mapM_ print

solve :: [[Int]] -> [Int]
solve = map f
  where f [x, y, b, p] = min u v
          where u = x * b + y * p
                v = (x * (max 5 b) + y * (max 2 p)) * 4 `div` 5



Measured memory_bytes: 4388
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef long double ld;
typedef vector<ll>VI;
typedef pair<ll,ll>P;
#define VV(T) vector<vector<T>>
#define sz(x) int(x.size())
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i,n) for (ll i=(ll)n-1;i>=0;i--)
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
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; }
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX6 1001001//6
#define MAX7 10010010//7
#define SENTINEL 2000000000//9
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define CLR(mat) memset(mat, 0, sizeof(mat))
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}//最大公約数
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}//最小公倍数
template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}
const int MOD = 1000000007;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
//push_back -> emplace_back


struct edge{int to,cost;};
//Pairに関して, firstは最短距離, secondは頂点の番号
int V;
vector<edge>G[MAX];
int d[MAX];
void dijkstra(int s){
    priority_queue<P,vector<P>,greater<P> >que;
    //firstが小さい順に取り出せる
    fill(d,d+V,INF);
    d[s]=0;
    que.push(P(0,s));
    while(!que.empty()){
        P p=que.top();que.pop();
        int v=p.second;
        if(d[v]<p.first)continue;
        for(int i=0;i<(int)G[v].size();i++){
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;//更新
                que.push(P(d[e.to],e.to));
            }
        }
    }
}
int main(){
    int n,x,y;cin>>n>>x>>y;
    x--;y--;
    G[x].emplace_back((edge){y,1});
    G[y].emplace_back((edge){x,1});
    V=n;
    rep(i,n-1){
       G[i].push_back((edge){i+1,1});
       G[i+1].push_back((edge){i,1});
    }
    VI dist(n,0);
    rep(i,n){
      dijkstra(i);
      rep(i,n){
         dist[d[i]]++;
      }
    }
    for(int i=1;i<n;i++)cout<<dist[i]/2<<endl;
}

Measured memory_bytes: 6052
n, x, y = map(int, input().split())
x = x - 1
y = y - 1
kl = [0] * (n - 1)

for s in range(n - 1):
    for e in range(s+1, n):
        d = e-s
        kl[min(d, abs(s-x)+abs(e-y)+1)-1] += 1

for i in kl:
    print(i)


Measured memory_bytes: 3444
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		var S = rs();
		Console.WriteLine(S.Substring(0,S.Length - 8));
	}

	public Sol(){
		
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

int main(){
  int a;
  int count = 0;
  std::vector<int> v;
  std::vector<std::vector<int> > x;
  while(std::cin >> a){
    v.push_back(a);
    count++;
  }
  int i;
  for(i = 0; i < count; i++){
    int data;
    data = v[i];
    int j;
    std::vector<int> w;
    for(j = 0; j < 10; j++){
      if(data == 0){
        break;
      }
      if(std::pow(2,9-j) <= data){
        w.push_back(std::pow(2,9-j));
        data -= std::pow(2,9-j);
      }
    }
    std::sort(w.begin(),w.end());
    x.push_back(w);
   }
  int k;
  for(k =0; k<count; k++){
    int l;
    for(l = 0; l<x[k].size(); l++){
      std::cout << x[k][l];
      if(l + 1 < x[k].size()){
        std::cout << " ";
      }
    }
    std::cout << "\n";
  }
  return 0;
}

Measured memory_bytes: 3272
private fun readInts() = readLine()!!.split(" ").map { it.toInt() }.toList()

fun main(args: Array<String>) {
    val (Q, H, S, D) = readInts()
    var N = readLine()!!.toLong()

    val single = setOf(4 * Q, 2 * H, S).min()!!
    val double = setOf(D, 2 * single).min()!!

    var ans = 0L
    while (N >= 2) {
        ans += double
        N -= 2
    }

    if (N == 1L) {
        ans += single
    }

    println(ans)
}

Measured memory_bytes: 37908
using System;
using static System.Console;
using System.Linq;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] c1 = ReadLine().ToCharArray();
            char[] c2 = ReadLine().ToCharArray();
            char[] c3 = ReadLine().ToCharArray();
            WriteLine(c1[0].ToString() + c2[1].ToString() + c3[2].ToString());
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
using namespace std;
int main()
{
  int c, a, b;
  cin >> a >> b >> c;
  if(a + b <= b + c && a + b <= a + c)
    cout << a + b;
  else if(b + c <= a + c && b + c <= a + b)
    cout << b + c;
  else if(a + c <= b + c && a + c <= a + b)
    cout << a + c;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, m, a, b, c;
	cin >> n >> m;
	for (a=0; a<=m/10000; a++)
		for (b=0; b<=m/5000; b++)
		{
			c=n-a-b;
			if (c>=0&&a*10000+b*5000+c*1000==m)
			{
				cout << a << ' ' << b << ' ' << c << endl;
				return 0;
			}
		}
	cout << "-1 -1 -1" << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/ruby

def solve(inputs)
  ans = 0
  inputs.each do |x, u|
    if u == :JPY
      ans += x
    else
      ans += 380000.0 * x
    end
  end
  ans
end

def each_case(sin)
  sin.gets
  inputs = []
  sin.each_line.map {|line|
    x, u = line.chomp.split(" ")
    inputs.push [x.to_f, u.to_sym]
  }
  yield inputs
end

each_case(STDIN) do |inputs|
  puts solve(inputs)
end




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

int N;
int bless[1000];
int state[1000];

int tominute(string& time){
	return stoi(time.substr(0, 2)) * 60 + stoi(time.substr(3, 2));
}

int main(){
	while(cin >> N, N){
		for(int i = 0; i < 1000; i++){
			bless[i] = 0;
			state[i] = 0;
		}
		string prev = "";
		int prevm = 0;
		for(int i = 0; i < N; i++){
			string day, time;
			char c;
			int id;
			cin >> day >> time >> c >> id;
			int m = tominute(time);
			int dm;
			if(day == prev){
				dm = m - prevm;	
			}else{
				dm = m;
			}
			if(state[0]){
				for(int i = 1; i < 1000; i++){
					if(state[i]){
						bless[i] += dm;
					}
				}
			}
			if(c == 'I'){
				state[id] = 1;
			}else{
				state[id] = 0;
			}
			
			prev = day;
			prevm = m;
		}
		int mv = 0;
		for(int i = 1; i < 1000; i++){
			mv = max(mv, bless[i]);
		}
		cout << mv << endl;
	}
}

Measured memory_bytes: 2964
#include <iostream>

using namespace std;
int main(void){

	int w,h,x,y,r;

	cin>>w>>h>>x>>y>>r;

	if(x<0||y<0){
		cout<<"No"<<endl;
		return 0;
	}
	
	if((w>=x+r)&&(h>=y+r)){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	
   return 0;
}



Measured memory_bytes: 3108
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  string S;
  cin >> S;
  int s1 = S[0] - '0';
  int s2 = S[1] - '0';
  int s3 = S[2] - '0';
  int s4 = S[3] - '0';
  int prev = s1 * 10 + s2;
  int post = s3 * 10 + s4;
  bool prev_MM = 0 < prev && prev <= 12;
  bool post_MM = 0 < post && post <= 12;
  if (prev_MM && post_MM) {
    cout << "AMBIGUOUS" << endl;
  } else if (prev_MM) {
    cout << "MMYY" << endl;
  } else if (post_MM) {
    cout << "YYMM" << endl;
  } else {
    cout << "NA" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <queue>
#include<iomanip>
#include <cmath>
#include <set>

#define ABS(x) ((x)>0?(x):-(x))
#define MIN(x,y) ((x)>(y)?(y):(x))
#define MAX(x,y) ((x)<(y)?(y):(x))

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

#define INF 1000000000

using namespace std;
typedef long long ll;

ll newton(long long int a, long long int  b)
{
	if(a==b)
		return a;
	while(a != 0 && b != 0)
	{
		if(a > b)
		{
			b += a;
			a = b-a;
			b -= a;
		}
		b %= a;
	}
	return a;
}

struct UnionFind {
	vector<int> p;
	UnionFind(int N):p(N)
	{
		for(int i=0; i< N; i++)
		{
			p[i] = i;
		}
	}
	int root(int x)
	{
		if(p[x] == x)
			return x;
		return p[x] = root(p[x]);
	}
	void unite(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		if(rx == ry) return;
		p[rx] = ry;
	}
	bool issame(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

//大きな数に対する割り算をするとき、MODを指定することで掛け算の値に変換できる

ll div2mul_calc(ll a, ll b, ll m)
{
	if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll d = div2mul_calc(a, b / 2, m);
        return (d * d) % m;
    } else {
        return (a * div2mul_calc(a, b - 1, m)) % m;
    }
}
ll div2mul(ll n, ll mod)
{
	return div2mul_calc(n, mod-2, mod);
}

ll twoRow(ll a, ll b, ll mod)
{
	ll ret = 1;
	for(ll i = 1 ;i <= a+b;++i)
	{
		ret *= i;
		ret %= mod;
	}
	for(ll i = 1 ;i <= a;++i)
	{
		ret *= div2mul(i,mod);
		ret %= mod;
	}
	for(ll i = 1 ;i <= b;++i)
	{
		ret *= div2mul(i,mod);
		ret %= mod;
	}
	return ret;
}

struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};

vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end());
  return (ret);
}
int main()
{
	ll N;
	cin>>N;
	cout << N*(N-1)/2 << endl;
	return 0;
}




















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define mod 1000000007LL
#define eps 1e-13
// #define PI 3.141592653589793238L
#define INF 1000000011
#define INFLL 1000000000000000011LL
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define fo(i,a,n) for(i = (a); i < (n); i++)
#define gtl(x) getline(cin, (x))
#define flsh fflush(stdout)
#define sws ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define gcd __gcd
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)((a).size())
#define io_file freopen("D:/Coding Problems/Contest/input_file.in", "r", stdin); freopen("D:/Coding Problems/Contest/output_file.out", "w", stdout)

ll modx(ll Base, ll exponent)
{
	ll ans = 1;
	if(Base == 1)
		return Base;
	while(exponent)
	{
		if(exponent & 1)
			ans = (ans * Base)%mod;
		Base = (Base * Base)%mod;
		exponent = exponent >> 1;
	}
	return ans;
}

ll inmodx(ll num)
{
	return (modx(num, mod-2LL));
}

bool cmp(pair < pll, int > a, pair < pll, int > b)//true for a before b
{
	if(a.F.F*b.F.S <= b.F.F*a.F.S)
		return 1;
	return 0;
}

const int N = (1e5) + 9;
const int M = (N<<2) + 9;
const int LOGN = ((int)log2(N)) + 3;
const int LOGM = ((int)log2(M)) + 3;
const int BUCK = 2*550;
const int SQRT = BUCK+9;



void solve()
{
	ll x, a;
	cin >> x >> a;
	if(x < a)
		cout << 0 << '\n';
	else
		cout << 10 << '\n';
	return;
}

int main()
{
	sws;
	clock_t clk;
	clk = clock();
	//io_file;
	// srand (time(NULL));

	//Code here
	int t = 1, cs;
	cout << fixed << setprecision(20);
	// cin >> t;
	fo(cs,1,t+1)
	{
		// cout << "Case #" << cs << ": ";
		solve();
	}
	// Code ends here

	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
	return 0;
}

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

#define int long long int
#define mp make_pair
using namespace std;

int n;
vector <int> v(402);
vector <int> pre(402);
int dp[402][402];

int fun(int start , int end)
{
    if(start == end){
        return 0;
    }
    if(start + 1 == end) {
        return v[start] + v[end];
    }
    if(dp[start][end] != -1){
        return dp[start][end];
    }
    dp[start][end] = 1e18;
    for (int i = start; i < end; ++i) {
        dp[start][end] = min(dp[start][end] , fun(start , i) + fun(i+1 , end) + pre[end] - pre[start - 1]) ;
    }
    return dp[start][end];
}

int32_t main() {
    scanf("%lld", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%lld", &v[i]);
        pre[i] = pre[i-1] + v[i];
    }
    for (int i = 0; i < 402; ++i) {
        for (int j = 0; j < 402; ++j) {
            dp[i][j] = -1;
        }
    }
    int ans = fun(1 , n);
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 1536
import java.util.Scanner;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        Map<Integer, List<Pair>> map = new HashMap<>();
        for (int i = 0; i < m; i++) {
            int pre = sc.nextInt();
            int year = sc.nextInt();
            if (!map.containsKey(pre)) {
                List<Pair> pairs = new ArrayList<>();
                map.put(pre, pairs);
            }
            Pair p = new Pair(i, year);
            map.get(pre).add(p);
        }
        for (Map.Entry<Integer, List<Pair>> entry : map.entrySet()) {
            Collections.sort(entry.getValue(), new PairComparator());
        }
        String[] ans = new String[m];
        for (Map.Entry<Integer, List<Pair>> entry : map.entrySet()) {
            int order = 0;
            for (Pair p : entry.getValue()) {
                order++;
                ans[p.city] = String.format("%06d%06d", entry.getKey(), order);
            }
        }
        for (String s : ans) {
            System.out.println(s);
        }
    }
}
class Pair {
    int city;
    int year;
    public Pair(int city, int year) {
        this.city = city;
        this.year = year;
    }
    public int compareTo(Pair p) {
        return this.year - p.year;
    }
    public String toString() {
        return String.format("city : %d year: %d %n", this.city, this.year);
    }
}
class PairComparator implements Comparator<Pair> {
    public int compare(Pair p1, Pair p2) {
        return p1.year - p2.year;
    }
}


Measured memory_bytes: 183232
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#include<map>
#include<iostream>
#include <cstring>
#include <iomanip>
#include <algorithm>
#define forr(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define input ios_base::sync_with_stdio(0);cin.tie(0);

const double PI  = acos(-1.0);
using namespace std;
//typedef pair<double,double>pdd;
typedef long long  ll;
typedef pair<ll, ll>pii;
//typedef complex<double> point;
//int x[8]={1,0,0,-1,-1,-1,1,1};
//int y[8]={0,1,-1,0,-1,1,-1,1};
//char rv[4]={'D','R','L','U'};
const double EPS = 1e-9;
const int N = 100000 + 9;
int k;
string s="ACL";

 int main()
{
//freopen("calc.in","r",stdin);
//freopen("calc.out","w",stdout);
//__builtin_popcount()
input
        int k;
        cin>>k;
        forr(i,1,k)cout<<s;



return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>>vii;
typedef vector<ll> vl;
typedef vector<vector<ll>>vll;
typedef pair <int, int> pii;
typedef pair<ll, ll> pll;


void solve(){
     
    return ;
}

int main(){
    ll a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t x;
  cin >> x;
  
  int64_t a = x/11*2;

  if(x%11 == 0){
    cout << a << endl;
  }
  else if(x%11 <= 6){
    cout << a+1 << endl;
  }
  else{
    cout << a+2 << endl;
  }
 
}
             
 

Measured memory_bytes: 3628
N, A, B, C, D = map(int, input().split())
S = input()
canA = "##" not in S[A-1:C]
canB = "##" not in S[B-1:D]
if C < D:
    if canA and canB:
        print("Yes")
    else:
        print("No")
else:
    if canA and canB and ("..." in S[B-2:D+1]):
        print("Yes")
    else:
        print("No")


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

using namespace std;

vector<int> a[100005];
int d[100005], n, m, ans, kt, x, y;

int main() {
    cin >> n >> m;
    for (int i = 1; i <= n; i++){
        cin >> d[i];
    }
    for (int i = 1; i <= m; i++){
        cin >> x >> y;
        a[x].push_back(y);
        a[y].push_back(x);
    }
    ans = 0;
    for (int i = 1; i <= n; i++){
        kt = 1;
        for (int j = 0; j < a[i].size(); j++){
            if (d[a[i][j]] >= d[i]){
                kt = 0;
                break;
            }
        }
        ans += kt;
    }
    cout << ans;
}

Measured memory_bytes: 9180
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

vector<pair<long long, long long>> A;


int main() {
    int N, M;
    cin >> N >> M;
    for (int i=0; i<N; i++) {
        long long a, b;
        cin >> a >> b;
        A.push_back(make_pair(a,b));
    }
    sort(A.begin(), A.end());
    long long c = 0;
    for (int i=0; i<N; i++) {
        if (M > A[i].second) {
            c+= A[i].first * A[i].second;
            M-=A[i].second;
        } else {
            c+=A[i].first * M;
            break;
        }
    }
    cout << c << endl;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

ll modpow(ll b, ll e, ll p) {
  if(e==0) return 1;
  if(e%2==0) {
    ll t = modpow(b,e/2,p);
    return (t*t)%p;
  }
  return (b*modpow(b,e-1,p))%p;
}

ll modinv(ll n, ll p) {
  return modpow(n,p-2,p);
}

ll modcomb(ll n, ll k, ll p) { // O(k)
  ll ans=1;
  for(ll i=n; i>=n-k+1; i--) {
    ans*=i;
    ans%=p;
  }
  for(ll i=1; i<=k; i++) {
    ans*=modinv(i,p);
    ans%=p;
  }
  return ans;
}

const ll p = 1e9+7;

ll f(ll n) {
  ll ans=modpow(n,3,p)-n%p;
  ans+=p;
  ans%=p;
  ans*=modinv(2*3,p);
  ans%=p;
  return ans;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  ll n,m,k;
  cin>>n>>m>>k;
  ll ans=0;
  ans+=(((m*m)%p)*f(n))%p;
  ans%=p;
  ans+=(((n*n)%p)*f(m))%p;
  ans%=p;
  ans*=modcomb(n*m-2,k-2,p);
  ans%=p;
  cout << ans << endl;
  return 0;
}


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

DP = [0, abs(h[0]-h[1])]

for i in range(N-2):
  DP += [min((DP[i] + abs(h[i]-h[i+2])),(DP[i+1] + abs(h[i+2]-h[i+1])))]
  
print(DP[-1])

Measured memory_bytes: 13980
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() { 
    int a, b;
    cin >> a >> b;
    int ab = stoi(to_string(a) + to_string(b));
    for (int i = 1; i * i <= ab; i++) {
        if (i * i == ab) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}




Measured memory_bytes: 3692
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] values = line.split(" ");
        long a = Long.parseLong(values[0]);
        long b = Long.parseLong(values[1]);
        if (a < 10) {
            b += (100 * (10 - a));
        }
        System.out.println(b);
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define sort(a) sort((a).begin(),(a).end())
#define rev(a) reverse((a).begin(),(a).end())
using db = double;
using namespace std;
typedef long long ll;

int main() {
  string s;
  cin >> s;
  int cnta = 0, cntb = 0, cntc = 0;
  rep(i,3) {
    if (s[i] == 'a') cnta++;
    if (s[i] == 'b') cntb++;
    if (s[i] == 'c') cntc++;
  }
  if (cnta == 1 && cntb == 1 && cntc == 1) cout << "Yes" << endl;
  else cout << "No" << endl;
}



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

int main() {
	int N,M,A;
	cin >> N >> M;

	rep(i,M) {
		cin >> A;
		N -= A;

		if(N < 0) {
			cout << -1 << endl;
			return 0;
		}
	}

	cout << N << endl;
}

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

int main(){
  string weather;
  cin >> weather;
  if (weather == "Sunny")
    cout << "Cloudy" << endl;
  else if (weather == "Cloudy")
    cout << "Rainy" << endl;
  else
    cout << "Sunny" << endl;
  return 0;
}


Measured memory_bytes: 256
[N, K] = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]

for i in range(N):
    p[i] = (p[i]*(p[i]+1))/(2*p[i])

ans = sum(p[:K])
now = sum(p[:K])

for i in range(K, N):
    now = now + p[i] - p[i-K]
    if now > ans:
        ans = now

print(ans)

Measured memory_bytes: 25188
from collections import Counter

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(int(n))
    return table

N, P = [int(a) for a in input().strip().split()]

facs = prime_decomposition(P)
facc = Counter(facs)

common = 1
for fac in facc.keys():
    count = facc[fac]
    while count >= N:
        common = common*fac
        count -= N

print(int(common))



Measured memory_bytes: 3316
A, B, C, X, Y = map(int, input().split())

ans = float("inf")
for c in range(200_001):
    cost = c * C
    cost += A * max(0, X - c // 2)
    cost += B * max(0, Y - c // 2)
    ans = min(ans, cost)
print(ans)


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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
// #define int long long
// #define pow mypow

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9+5;
const int MOD = 1e9+7;

int n, m;
vector<int> g[N];
int p[N];
int32_t main()
{
	IOS
	// freopen("input.txt", "r", stdin);
	cin >> n >> m;
	while(m--) {
		int u, v; cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	queue<int> q;
	q.push(1);
	while(!q.empty()){
		int v = q.front(); q.pop();
		for(auto u:g[v]){
			if (p[u]) continue;
			p[u] = v;
			q.push(u);
		}
	}
	for(int i=2; i<=n; i++) 
		if (p[i] == 0) {
			cout << "No" << endl;
			return 0;
		}

	cout << "Yes" << endl;
	for(int i=2; i<=n; i++) cout << p[i] << endl;
	
	return 0;
}


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

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

  int v[25],c[25];
  for (int i=0; i<n; i++) {
    cin>>v[i];
  }
  for (int i=0; i<n; i++) {
    cin>>c[i];
  }
  int ans=0;
  for (int i=0; i<n; i++) {
    if (v[i]>c[i]) ans+=v[i]-c[i];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256