akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ull unsigned long long int
#define ll long long
#define int long long
#define ld long double
#define endl '\n'
const int mod= 1e9+7;
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define trace(x) cerr << #x << " is " << x << endl;
#define all(x) x.begin(),x.end()
#define reset(x,val) memset(x,val,sizeof(x))
#define flush fflush(stdout)
#define sz(a) a.size()
#define pii pair<int,int>
using namespace std;
const int N=100005;
int dp[N][2],n;
vector<int> g[N];
int dfs(int node,int p,int c)
{
 if(dp[node][c]!=-1)
 return dp[node][c];
 int &ans=dp[node][c];
 ans=1;
 for(int nx:g[node])
 {
  if(nx==p)continue;
  if(c==0)
  {
   ans*=(dfs(nx,node,0)+dfs(nx,node,1));
  }
  else
  {
   ans*=dfs(nx,node,0);
  }
  ans%=mod;
 }
 
 return ans;
}
int32_t main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    cin>>n;
    for(int i=0;i<=n;i++)
    {
     dp[i][0]=-1;
     dp[i][1]=-1;
    }
    for(int i=1;i<n;i++)
    {
     int u,v;
     cin>>u>>v;
     g[u].pb(v);
     g[v].pb(u);
    }
    cout<<( dfs(1,0,0)+dfs(1,0,1))%mod;
    return 0;
}



Measured memory_bytes: 15616
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {
  ll n, T;
  cin >> n >> T;
  vll t(n);
  rep(i,n) cin >> t.at(i);
  ll ans = 0;
  rep(i,n-1) {
    ll u = t[i+1] - t[i];
    if(u>T) ans += T;
    else ans += u;
  }
  ans += T;
  cout << ans << endl;
  return 0;
}

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

int main()
{
	int n;
	std::cin >> n;
	std::vector<int> l(n);
	for (auto &e : l) std::cin >> e;
	
	int count = 0;
	for (int i = 0; i < n - 2; i++)
		for (int j = i + 1; j < n - 1; j++)
			for (int k = j + 1; k < n; k++)
				if (l[i] != l[j] && l[j] != l[k] && l[k] != l[i] && l[i] + l[j] > l[k] && l[j] + l[k] > l[i] && l[k] + l[i] > l[j]) {
					count++;
				}
	
	std::cout << count << std::endl;
	
	return 0;
}


Measured memory_bytes: 3196
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define INF 1e9
typedef long long ll;
using namespace std;

int main() {
    int a, b; cin >> a >> b;
    int dif = b-a;
    int pole = 0;
    for(int i = 1; i <= dif; i++){
        pole+=i;
    }
    cout << pole-b << endl;
    return 0;
}

Measured memory_bytes: 256
from math import pi,cos,sin,sqrt

def readinput():
    a,b,h,m=list(map(int,input().split()))
    return a,b,h,m

def main(a,b,h,m):
    tmin=h*60+m
    u=tmin*2*pi/(12*60)
    t=m*2*pi/60
    dist=sqrt(
        (a*cos(u)-b*cos(t))**2
        +(a*sin(u)-b*sin(t))**2
        )
    return dist

if __name__=='__main__':
    a,b,h,m=readinput()
    ans=main(a,b,h,m)
    print('{:.10f}'.format(ans))


Measured memory_bytes: 9524
#include <stdio.h>
void solve(void)
{
	char pre[10], s[101], post[10], shortname[4]={0};
	scanf("%s %s %s", pre, s, post);
	shortname[0] = pre[0];
	shortname[1] = s[0];
	shortname[2] = post[0];
	printf("%s\n", shortname);
}
int main(int argc, char **argv)
{
	solve();
	return 0;
}


Measured memory_bytes: 128
K = int(input())
A,B = map(int,input().split())
flag = False
for i in range(A,B+1):
    if i%K==0:
        flag = True
        break
    else:
        continue
if A==B and A%K==0:
    flag = True
if flag:
    print('OK')
else:
    print('NG')

Measured memory_bytes: 61908
import static java.lang.System.*;
import java.util.*;
 
public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int a=sc.nextInt(), b=sc.nextInt(), x=sc.nextInt();
		
		if (x < a) out.println("NO");
		else {
			out.println(x-a<=b?"YES":"NO");
		}
	}
}

Measured memory_bytes: 21844
integer N
integer(16),allocatable,dimension(:)::H
integer ans,preans
read*,N
allocate(H(N))
read*,H
ans=0;preans=0
do i=1,N-1
  if(H(i)>=H(i+1))then
    preans=preans+1
  else
    ans=max(ans,preans)
    preans=0
  endif
end do
ans=max(ans,preans)
print"(i0)",ans
end

Measured memory_bytes: 2304
n = gets.to_i
a = []
b = []
$<.map{|l|
  ai, bi = l.split.map(&:to_i)
  a << ai
  b << bi
}
a.sort!
b.sort!
if n%2==1
  p b[n/2] - a[n/2] + 1
else
  p (b[n/2-1]+b[n/2]) - (a[n/2-1]+a[n/2]) + 1
end


Measured memory_bytes: 21872
#include <stdio.h>

int main(){
  int i,n,a,v,aa,vv;

  scanf("%d",&n);
  vv=-1;
  for(i=0;i<n;i++){
    scanf("%d %d\n",&a,&v);
    if(v>vv||(vv==v&&a<aa))vv=v,aa=a;
  }
  printf("%d %d\n",aa,vv);
  return 0;
}

Measured memory_bytes: 604
"use strict";
function Main(input) {
  input = input.split("\n");
  const num = input.shift();
 
  let mochis = [];
  for (let i = 0; i < num; i++) {
    if (mochis.indexOf(parseInt(input[i])) === -1) {
      mochis.push(parseInt(input[i]));
    }
  }
  console.log(mochis.length);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf-8"));

Measured memory_bytes: 21064
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  int key;
  for(i = 1 ; i <= n ; i++){
    key = A[i];
    j = i -1;
    while(j >= 0 && A[j] > key){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = key;
    trace(A, n);
  }
  
  return 0;
}

Measured memory_bytes: 608
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <numeric>

using namespace std;
int a[26];
int main(){
    string s;
    cin >> s;
    string ans = "yes";
    for(size_t i = 0; i < s.size(); i++)
    {
        a[s[i]-'a']++;
    }
    for(size_t i = 0; i < 26; i++)
    {
        if(a[i] == 0 || a[i] == 1)continue;
        else ans = "no";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
x, y = map(int, input().split())
if x in a and y in a:
  print("Yes")
elif x in b and y in b:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9184
#include "bits/stdc++.h"
using namespace std;

int main(){

	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif

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

	int n,k; cin >> n >> k;

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

	for(int j=k;j<n;j++){
		if(a[j]>a[j-k]) cout << "Yes" << endl;
		else cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 4432
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll N, K;

namespace mod {

	ll MOD = 1000000007;

	//x+y
	ll add(ll x, ll y) {
		return (x + y) % MOD;
	}

	//x-y
	ll sub(ll x, ll y) {
		return (x + MOD - (y % MOD)) % MOD;
	}

	//x*y
	ll mul(ll x, ll y) {
		return ((x % MOD) * (y % MOD)) % MOD;
	}

	//x^y
	ll power(ll x, ll y) {
		if (y == 0) {
			return 1;
		}
		else if (y == 1) {
			return x % MOD;
		}
		else if (y % 2 == 0) {
			ll pow = power(x, y / 2);
			return (pow * pow) % MOD;
		}
		else {
			ll pow = power(x, y / 2);
			return (((pow * pow) % MOD) * x) % MOD;
		}
	}

	//x/y
	ll div(ll x, ll y) {
		return mul(x, power(y, MOD - 2));
	}

	//階乗x~y xからyまでかける
	ll fact(ll x, ll y) {
		if (x < y) {
			return 0;
		}
		else if (x == y) {
			return x;
		}
		else {
			return mul(x, fact(x - 1, y));
		}
	}

	//組み合わせ nCr
	ll conbi(ll n, ll r) {
		return div(fact(n, n - r + 1), fact(r, 1));
	}

	//順列 nPr
	ll perm(ll n, ll r) {
		return fact(n, n - r + 1);
	}

	//重複組合せ nHr
	ll homo(ll n, ll r) {
		return conbi((n + r - 1), r);
	}
}

void solve() {
	cin >> N >> K;

	if (N == 1) {
		cout << K;
		return;
	}

	vector<vector<ll>> edge(N);
	
	rep(i, N - 1) {
		ll a, b;
		cin >> a >> b;
		a--; b--;
		edge[a].emplace_back(b);
		edge[b].emplace_back(a);
	}

	rep(i, N) {
		if (edge[i].size() + 1 > K) {
			cout << 0;
			return;
		}
	}

	queue<ll> Q;
	Q.push(0);

	vector<bool> chk(N, false);

	ll ans = 1;
	while (Q.size() != 0) {

		ll node = Q.front();
		Q.pop();
		chk[node] = true;

		if (node!=0 && edge[node].size() == 1) continue;

		if (node == 0) {
			ans = (ans * mod::fact(K - 1, K-1 - edge[node].size() + 1)) % mod::MOD;
		}
		else {
			ans = (ans * mod::fact(K - 2, K - 2 - edge[node].size()+2)) % mod::MOD;
		}

		rep(i,edge[node].size()) {
			if (chk[edge[node][i]]==false) Q.push(edge[node][i]);
		}

	}

	cout << (ans * K) % mod::MOD;

}

int main() {
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 8948
#include <iostream>
#include <algorithm>
#include <deque>
#include <string>
#include <utility>

#define phb push_back
#define ppf pop_front
#define mkp make_pair
#define r first
#define c second
using namespace std;

typedef pair< int, int > Pr;
const int kDir[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};

int R, C, SR, SC;
char M[25][25];

void read();
void solve();

int main() {
  while (cin >> C >> R, R != 0 && C != 0)
    read(), solve();

  return 0;
}

void read() {
  fill(&M[0][0], &M[25][0], '#');
  for (int i = 1; i <= R; ++i)
    for (int j = 1; j <= C; ++j) {
      cin >> M[i][j];
      if (M[i][j] == '@')
        M[i][j] = '.', SR = i, SC = j;
    }
}

void solve() {
  static int vst[25][25], vst_cnt;
  int res = 0;
  deque< Pr > que;

  que.phb(mkp(SR, SC)), vst[SR][SC] = ++vst_cnt;
  while (!que.empty()) {
    Pr cur = que.front(); que.ppf(), ++res;
    for (int di = 0; di < 4; ++di) {
      Pr nxt(cur.r + kDir[di][0], cur.c + kDir[di][1]);
      if (M[nxt.r][nxt.c] == '.' && vst[nxt.r][nxt.c] != vst_cnt)
        que.phb(nxt), vst[nxt.r][nxt.c] = vst_cnt;
    }
  }

  cout << res << "\n";
}

Measured memory_bytes: 1212
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
using namespace std;

int main() {
    string S;
    cin >> S;
    S[3] = '8';

    cout << S << endl;

    return 0;
}

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
using ld = long double;
ll mod = 1000000007;

ll rep_square(ll a, ll b) {
    // return a^b
    ll ans = 1;
    ll base = a;
    while (b != 0) {
        if (b & 1) {
            ans *= base;
            ans %= mod;
        }
        base *= base;
        base %= mod;
        b >>= 1;
    }
    return ans;
}

ll solve(ll n, ll m) { return rep_square(2, 2 * n - 2) * (2 + m) % mod; }

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) { cin >> a[i]; }

    sort(a.begin(), a.end(), greater<ll>());

    ll ans = 0;
    rep(i, n) {
        ans = ans + a[i] * solve(n, i);
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4780
# heapq -> deque

def main():
    from collections import defaultdict, deque

    inf = 10 ** 27

    T = int(input())
    for _ in range(T):
        N, A, B, C, D = map(int, input().split())

        dq = deque()
        dq.append((0, N))  # cost,value
        checked = defaultdict(lambda: inf)

        ans = N * D + 1
        while dq:
            cost, x = dq.popleft()
            if cost >= ans: continue
            if cost >= checked[x]: continue
            checked[x] = cost

            # 0まで1ずつ減らす
            ans = min(ans, cost + x * D)

            for d, c in ((2, A), (3, B), (5, C)):
                # すでにheapqからnxがpopしていれば
                # より低コストでnxを生成できているので
                # nxの生成は不要
                nx, r = divmod(x, d)
                ncost = cost + r * D + c
                if checked[nx] > ncost:
                    dq.append((ncost, nx))
                ncost = cost + (d - r) * D + c
                if (r > 0) and (checked[nx + 1] > ncost):
                    dq.append((ncost, nx + 1))

        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 16516
//マージソート
//2018-12-21
//Ebitani Akira

#include <stdio.h>
#include <stdlib.h>

#define N 500000
#define N2 1000000000

void Merge( int *, int, int, int );
void MergeSort( int *, int, int );

int count = 0;
int array[N];

int main (){
  int i, j, n;

  scanf( "%d", &n );
  if( n < 0 || n > 500000 ){
    printf("要素数が適当ではありません。\n");
    exit(1);
  }
  for( i = 0 ; i < n ; i++ ){
    scanf( "%d", &array[i] );
  }

  MergeSort( array, 0, n );
  
  for( i = 0 ; i < n ; i++ ){
    printf( "%d", array[i] );
    if( i != n - 1 ){
      printf( " " );
    }
  }

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

  return 0;
}
    
void MergeSort( int array[], int left, int right ){
  int mid;

  if( left + 1 < right ){

    mid = ( left + right ) / 2;
    MergeSort( array, left, mid );
    MergeSort( array, mid, right );
    Merge( array, left, mid, right );
  }
}

void Merge( int array[], int left,int mid, int right ){
  int n_left, n_right;
  n_left = mid - left;
  n_right = right - mid;

  int i = 0, j = 0, k;

  int Left[n_left];
  int Right[n_right];
  
 for( i = 0 ; i < n_left ; i++ ){
    Left[i] = array[left + i];
  }
  for( i = 0 ; i < n_right ; i++ ){
    Right[i] = array[mid + i];
  }

  Left[n_left] = N2;
  Right[n_right] = N2;
  
  for( i = 0, j = 0, k = left ; k < right ; k++ ){
    count = count + 1;

    if( Left[i] <= Right[j] ){
      array[k] = Left[i];
      i++;
    }
    else{
      array[k] = Right[j];
      j++;
    }
  }
}




Measured memory_bytes: 5608
N,T=map(int,input().split())
A=list(map(int,input().split()))
t=0
k=A[0]
c=0
for i in A:
    if i<k:
        k=i
    elif i-k>t:
        t=i-k
        c=1
    elif i-k==t:
        c+=1
print(c)

Measured memory_bytes: 14252
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <iterator>

using namespace std;

int main()
{
	int n; cin >> n;
	map<string, int> m;
	string s;
	int maxi = 0;
	for (int i = 0; i < n; ++i)
	{
		cin >> s;
		m[s]++;
		maxi = max(maxi, m[s]);
	}
	vector<string> ans;
	for (auto& p : m)
	{
		if (p.second == maxi)
		{
			ans.push_back(p.first);
		}
	}

	sort(ans.begin(), ans.end());
	copy(ans.begin(), ans.end(), ostream_iterator<string>(cout, "\n"));
	return 0;
}


Measured memory_bytes: 26868
#include <algorithm>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/irange.hpp>
#include <cmath>
#include <map>
#include <numeric>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
namespace mp = boost::multiprecision;
typedef long long ll;
const ll M = 1000000007;

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

	int count = 0;
	int n = s.length();
	int m;
	if (n % 2 == 0) {
		m = n/2;
	} else {
		m = n/2 + 1;
	}
	for(int i = 0; i< m; i++) {
		if (s[i] != s[n-i-1]) {
			count++;
		}
	}

	cout << count;

	return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int INF = 100010001;

int main() {
    int n;
    cin >> n;
    vector<int> dp(n+10, INF);
    dp[0] = 0;
    for(int i = 1; i <= n; ++i){
        dp[i] = 1 + dp[i-1];
        
        for(int power = 6; power <= i; power*=6){
            dp[i] = min(dp[i], dp[i-power]+1);
        }

        for(int power = 9; power <= i; power*=9){
            dp[i] = min(dp[i], dp[i-power]+1);
        }

    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

class Pair<F, S>{
	F first;
	S second;
	public Pair(F f, S s) {
		first = f;
		second = s;
	}
}

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Pair<Integer, Integer>[] dishes = new Pair[N];
		for(int i = 0; i < N; i++) {
			dishes[i] = new Pair<Integer, Integer>(sc.nextInt(), sc.nextInt());
		}
		Arrays.sort(dishes, new Comparator<Pair<Integer, Integer>> () {
			public int compare(Pair<Integer, Integer> o1, Pair<Integer, Integer> o2) {
				return - (o1.first + o1.second) + (o2.first + o2.second);
			}
		});
		long Takahashi = 0, Aoki = 0;
		for(int i = 0; i < N; i++) {
			if(i % 2 == 0) {
				Takahashi += (long)dishes[i].first;
			}
			else {
				Aoki += (long)dishes[i].second;
			}
		}
		System.out.println(Takahashi - Aoki);
	}
}

Measured memory_bytes: 96984
from collections import defaultdict

def calc(data):
    count = defaultdict(int)
    for num in data:
        count[num] += 1

    count_data = []
    for i, j in count.items():
        count_data.append([i, j])

    count_data.sort(key=lambda x: -x[1])
    return count_data


def main():
    num = int(input())
    data = list(map(int, input().split()))

    data_e = data[::2]
    data_o = data[1::2]

    count_e = calc(data_e)
    count_o = calc(data_o)

    if count_e[0][0] != count_o[0][0]:
        ans = num - count_e[0][1] - count_o[0][1]
    elif len(count_e) == 1 and len(count_o) == 1:
        ans = num - count_e[0][1]
    elif len(count_e) == 1:
        ans1 = num - count_o[0][1]
        ans2 = num - count_e[0][1] - count_o[1][1]
        ans = min(ans1, ans2)
    elif len(count_o) == 1:
        ans1 = num - count_e[0][1]
        ans2 = num - count_o[0][1] - count_e[1][1]
        ans = min(ans1, ans2)

    else:
        ans1 = num - count_e[0][1] - count_o[1][1]
        ans2 = num - count_e[1][1] - count_o[0][1]
        ans = min(ans1, ans2)

    print(ans)




if __name__ == '__main__':
    main()

Measured memory_bytes: 22484
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n, u, v = ns()
    edge = [[] for _ in range(n)]

    for _ in range(n - 1):
        a, b = ns()
        a -= 1
        b -= 1
        edge[a].append(b)
        edge[b].append(a)

    dist_takahashi = [-1] * n
    dist_aoki = [-1] * n

    def bfs(pos, dist):
        que = queue.Queue()
        que.put(pos)
        dist[pos] = 0

        while not que.empty():
            current = que.get()
            for e in edge[current]:
                if dist[e] == -1:
                    dist[e] = dist[current] + 1
                    que.put(e)

        return dist

    dist_takahashi = bfs(u - 1, dist_takahashi)
    dist_aoki = bfs(v - 1, dist_aoki)

    ans = 0
    for dt, da in zip(dist_takahashi, dist_aoki):
        if dt < da:
            ans = max(ans, da - 1)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 34928
r1=list(map(int,input().split()))
r2=list(map(int,input().split()))
r3=list(map(int,input().split()))
N=int(input())
a=[]
for i in range(N):
    a.append(int(input()))


bing=[[0,0,0],[0,0,0],[0,0,0]]

for i in range(0,3):
    if r1[i] in a:
        bing[0][i]=1
    if r2[i] in a:
        bing[1][i]=1
    if r3[i] in a:
        bing[2][i]=1


ans=0

if sum(bing[0])==3 or sum(bing[1])==3 or sum(bing[2])==3:
    ans += 1

if bing[0][0]+bing[1][0]+bing[2][0]==3 or bing[0][1]+bing[1][1]+bing[2][1]==3 or bing[0][2]+bing[1][2]+bing[2][2]==3:
    ans += 1

if bing[0][0]+bing[1][1]+bing[2][2]==3 or bing[2][0]+bing[1][1]+bing[0][2]==3:
    ans += 1

if ans >=1:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
# import copy
# answers = []

from sys import stdin
input = stdin
def solve():
    while True:
        n, m = map(int,input.readline().split())
        if n == 0 and m == 0:
            break
        # c = []
        # x = [128]
        INF = float('inf')
        # for i in range(m):
        #     c.append(int(input()))
        c = tuple(int(input.readline()) for i in range(m))
        tb1 = tuple(tuple((i-j)**2 for i in range(256)) for j in range(256))
        tb2 = tuple(tuple(255 if i+ci>255 else 0 if i+ci<0 else i+ci for ci in c) for i in range(256))
        # for j in range(n):
        #     x.append(int(input()))
        # dp = [[INF]*(256) for _ in range(n+1)] #dp[i][j]は信号の大きさj入力した時のi番目の信号との二乗誤差の合計
        dp1 = [INF]*256
        dp2 = [INF]*256
        # prev = set([128])
        # dp[0][128] = 0
        dp1[128] = 0
        for i in range(n):
            x = int(input.readline())
            # nexts = set([])
            # print(prev)
            tb1_x = tb1[x]
            # for j in range(256):
            for j,precost in enumerate(dp1):
                for a in tb2[j]:
                    # a = j + c[k]
                    # a = tb2[j][k]
                    # nexts.add(a)
                    # print(dp2[a],dp1[j] + tb1[a][x])
                    # dp[i+1][a] = min(dp[i+1][a],dp[i][j] + tb1[a][x])
                    newcost = precost+tb1_x[a]
                    if newcost<dp2[a]:
                        dp2[a] = newcost
                    # dp2[a] = min(dp2[a], dp1[j] + tb1_x[a] )
            # prev = nexts
            dp1 = dp2[:]
            dp2 = [INF]*256
        # for i in range(n+1):
        #     print(x[i],"→",*dp[i][120:256])
        print(min(dp1))
solve()
# for ans in answers:
#     print(ans)


Measured memory_bytes: 11044
n, m = map(s->parse(BigInt,s),split(readline()))
answer = big"1"
i = big"2"
while i^2 <= m
  if mod(m,i) == 0
    count = big"0"
    while mod(m,i) == 0
      m = div(m,i)
      count += 1
    end
    answer *= binomial(n+count-1,count)
  end
  i += 1
end
if m > 1
  answer *= n
end
println(mod(answer,big"1000000007"))


Measured memory_bytes: 168948
#!/usr/bin/env python3

# input = stdin.readline

def solve(sx,sy,tx,ty):
  res = []
  dx = tx - sx
  dy = ty - sy
  
  assert dx > 0 and dy > 0
  # 1回目
  res.extend(['R']*dx)
  res.extend(['U']*dy)
  res.extend(['L']*dx)
  res.extend(['D']*dy)

  # 2回目
  res.append('D')
  res.extend(['R']*(dx+1))
  res.extend(['U']*(dy+1))
  res.append('L')

  res.append('U')
  res.extend(['L']*(dx+1))
  res.extend(['D']*(dy+1))
  res.append('R')
  return ''.join(res)


def main():
  sx,sy,tx,ty = map(int,input().split())
  print('{}'.format(solve(sx,sy,tx,ty)))

if __name__ == '__main__':
  main()


Measured memory_bytes: 9148
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions
bool second_greater(const pii& left, const pii& right) {
    return left.second > right.second;
}
#endif


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

    int N; cin >> N;
    vi a(N), b(N); REP(i, N) cin >> a[i] >> b[i];
    vi c(N), d(N); REP(i, N) cin >> c[i] >> d[i];

    vector<pii> red(N), blue(N);
    REP(i,N){
        red[i] =pii(a[i], b[i]);
        blue[i] = pii(c[i], d[i]);
    }

    sort(blue.begin(), blue.end());
    sort(red.begin(), red.end(), second_greater);

    vvi pair(N);
    vb used(N, false);
    REP(i,N) {
        int bx = blue[i].first;
        int by = blue[i].second;
        REP(j,N) {
            if (used[j]) continue;
            int rx = red[j].first;
            int ry = red[j].second;
            if (rx<bx && ry <by) {
                pair[i].push_back(j);
                used[j] = true;
                break;
            }
        }
    }

    int ans = 0;
    REP(i, N) {
        if (used[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}


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

int bubbleSort (vector<int> &A, int N) {
  int sw = 0;
  bool flag = 1;
  int i = 0;
//  while (flag) {
    for (i = 0; flag; i++) {
    flag = 0;
    for (int j = N - 1; j >= i + 1; j--) {
      if (A.at(j) < A.at(j - 1)) {
        swap(A.at(j), A.at(j - 1));
        flag = 1;
        sw++;
      }
    }
  }
  return sw;
}
  
int main() {
  int N, sw;
  cin >> N;
  
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }  
  
  sw = bubbleSort(A, N);
  
  for (int i = 0; i < N; i++) {
    if (i > 0) cout << " ";
    cout << A.at(i);
  }
  cout << endl;
  cout << sw << endl;
}



Measured memory_bytes: 3100
import java.util.*;
import java.io.*;
class Main{
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out, true);
		String str=sc.nextLine();
		int max = 0;
		int count = 0;
		for(int i=0;i<str.length();i++){
			if(str.charAt(i)=='R'){
				count++;
				max = Math.max(count, max);
			}else{
				count = 0;
			}
		}
		out.println(max);
	}
}


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





int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  ll N, M;
  cin >> N >> M;
  vector<ll> A(N);
  for (ll i=0; i<N; i++){
    cin >> A[i];
  }
  ll temp=0;

  map<ll,ll> count;
  vector<ll> elem;

  count[0]=1;
  elem.push_back(0);
  for (ll i: A){
    temp=(temp+i)%M;
    //cout<<temp<<endl;
    if (count.find(temp)!=count.end()){
      count[temp]++;
    } else{
      count[temp]=1;
      elem.push_back(temp);
    }
  }
  ll ans=0;
  for (ll i=0; i<elem.size(); i++){
    ll curr=count[elem[i]];
    ans+=(long long) curr*(curr-1)/2;
  }
  cout<<ans<<endl;
 
} 


Measured memory_bytes: 5496
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define int long long
using namespace std;
typedef pair<int,int> P;
int gcd(int a,int b){
    if(a%b==0)return b;
    else return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
struct edge{
    int to,cost;
};
class dijkstra{
    int V;
    int d[100002];
    priority_queue<P,vector<P>,greater<P>>que;
    void update(int s,vector<edge> G[]){
        fill(d,d+V+1,100000000000ll);
        d[s]=0;
        que.push(make_pair(0,s));
        while(!que.empty()){
            P p=que.top();
            que.pop();
            int v=p.second;
            if(d[v]<p.first)continue;
            rep(i,G[v].size()){
                edge e=G[v][i];
                if(d[e.to]>d[v]+e.cost){
                    d[e.to]=d[v]+e.cost;
                    que.push(make_pair(d[e.to],e.to));
                }
            }
        }
    }
public:
    dijkstra(int v,int s,vector<edge> G[]){
        V=v;
        update(s,G);
    }
    int find(int e){
        return d[e];
;    }
};
signed main(){
    int a[5],ans=LLONG_MAX;
    cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
    sort(a,a+5);
    do{
        int uans=0;
        rep(i,4){
            uans+=a[i];
            uans=uans+9-(uans-1)%10;
        }
        uans+=a[4];
        ans=min(ans,uans);
    }while(next_permutation(a,a+5));
    cout<<ans<<endl;
}



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

using namespace std;

using ll = long long;
#define long long long

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

    char l = '.';
    set<string> s;
    while(n--) {
        string w;
        cin >> w;
        if(s.count(w) || (l != '.' && w[0] != l)) {
            cout << "No" << endl;
            return 0;
        }
        s.insert(w);
        l = w[w.size()-1];
    }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#define inf 1e9
 
using namespace std;
 
int n, m;
int b[505][505];
int B[505];
int bit[505];
int dp[2][1 << 22];
 
int main(void)
{
    while(1){
        cin >> n >> m;
        if(n == 0 && m == 0) break;
         
        for(int i = 1; i <= n; i++){
            for(int j = 0; j < m; j++){
                char c;
                cin >> c;
                b[i][j] = c - '0';
            }
        }
         
        int ans = 0;
        if(n <= 22){
            int S = 1 << n;
            for(int i = 0; i < S; i++){
                int cnt = 0;
                for(int j = 0; j < m; j++) bit[j] = 0;
                for(int j = 1; j <= n; j++){
                    if( (i & (1<<(j-1))) == 0) continue;
                    cnt++;
                    for(int k = 0; k < m; k++) bit[k] ^= b[j][k];
                }
                bool flag = false;
                for(int j = 0; j < m; j++) flag |= bit[j];
                if(!flag) ans = max(ans, cnt);
            }
        }
        else{
             
            for(int i = 1; i <= n; i++){
                B[i] = 0;
                for(int j = 0; j < m; j++) B[i] |= (b[i][j] << j);
            }
             
            int S = 1 << m;
            for(int i = 0; i < S; i++) dp[0][i] = dp[1][i] = -inf;
            dp[0][0] = 0;
            for(int i = 0; i < n; i++){
                for(int j = 0; j < S; j++){
                    dp[(i+1)%2][j^B[i+1]] = max(dp[(i+1)%2][j^B[i+1]], dp[i%2][j] + 1);
                    dp[(i+1)%2][j] = max(dp[(i+1)%2][j], dp[i%2][j]);
                }
            }
            ans = dp[n%2][0];
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 20444
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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;}

const ll INF=1e9+7;

int main(){
    ll n,m;
    cin >> n >> m;
    vector<ll> a(n),b(n),c(m),d(m);
    rep(i,n){
        cin >> a[i] >> b[i];
    }
    rep(i,m){
        cin >> c[i] >> d[i];
    }
    rep(i,n){
        ll dist=INF;
        ll pos=-1;
        rep(j,m){
            ll buf=abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(buf<dist){
                dist=buf;
                pos=j;
            }
        }
        cout << pos+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3608
// clang-format off

#include <bits/stdc++.h>

#define int long long int
#define main signed main()
#define bye return 0
#define rep(i, n) for (int i = 0; i < (n); i++)
#define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++)
#define all(v) (v).begin(), (v).end()
#define prec(n) fixed << setprecision(n)
#define exact(x) { return (x); }

#define sum(v) accumulate(all(v), 0)
#define stlice(s, l) substr(s, (s) + (l) + 1)
#define odd(n) ((n) % 2)
#define even(n) (!((n) % 2))

#define INF 1e9
#define MOD (1e9 + 7)

#define pb push_back
#define mt make_tuple
#define fi first
#define se second
#define str string
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<str>

using namespace std;

// clang-format on

main {
  int n;
  cin >> n;
  int a[n], b[n];
  rep(i, n) cin >> a[i] >> b[i];
  int c = 0;
  rep(i, n) {
    int p = a[n - 1 - i], q = b[n - 1 - i];
    c += (q - (p + c) % q) % q;
  }
  cout << c << endl;
  bye;
}


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

using namespace std;
using ll = long long;

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x(x % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) {
      x -= mod;
    }
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) {
      x -= mod;
    }
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) {
      return 1;
    }
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) {
      a *= *this;
    }
    return a;
  }

  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) { return mint(*this) /= a; }
};

istream& operator>>(istream& is, mint& a) {
  return is >> a.x;
}
ostream& operator<<(ostream& os, const mint& a) {
  return os << a.x;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<bool> as(n, false);
  rep(i, m) {
    int a;
    cin >> a;
    as[a] = true;
  };
  vector<mint> dp(n + 2, 0);
  dp[0] = 1;
  rep(i, n) {
    if (!as[i + 1]) {
      dp[i + 1] += dp[i];
    }
    if (!as[i + 2]) {
      dp[i + 2] += dp[i];
    }
  }
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 4048
//============================================================================
// Name        : AOJ.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <algorithm>

using namespace std;

int w,h,c;
int d[100001]={};

int main() {
	cin>>w>>h>>c;
	int e=min(w,h);
	int i;
	for(i=e;w%i!=0||h%i!=0;--i);
	cout<<((w/i)*(h/i))*c<<endl;
	return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 100005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
ll n,ar[N][3],dp[N][4];
ll maxval(ll i,ll flg){
	if(i==n+1) return 0;

	if(dp[i][flg]!=-1){
		return dp[i][flg];
	}
	ll j,an=0;
	for(j=1;j<=3;j++){
		if(j==flg) continue;
		an=max(an,maxval(i+1,j)+ar[i][j-1]);
	}
	return dp[i][flg]=an;
}
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>ar[i][0]>>ar[i][1]>>ar[i][2];
	}
	memset(dp,-1,sizeof(dp));
	ll an=maxval(1,0);
	cout<<an<<endl;
	return 0;	
}

Measured memory_bytes: 15188
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x

int main() {

  int A, B, ans, i,sum;

  cin >> A >> B;
  //A--;

  REP(i, 1000000){
    if( i == 0 ){
      sum = 1;
    }else{
      sum += A - 1;
    }
    if( sum >= B ){
      ans = i;
      break;
    }
  }

  cout << ans << endl;

}

/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

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

int main() {
  int n,m;
  cin >> n >> m;
  
  vector<int> a(2*m);
  for(int i=0; i<2*m; i++){
    cin >> a[i];
  }
  
  int min = 0;
  int max = 1000000;
  
  for(int i=0; i<=m-1; i++){
    if(a[2*i] >= min){
      min = a[2*i];
    }
  }
  
  for(int i=0; i<=m-1; i++){
    if(a[2*i+1] <= max){
      max = a[2*i+1];
    }
  }
  
  if(max-min>=0){
  cout << max-min+1 << endl;
  }
  else{
    cout << 0 << endl;
  }
	return 0;
}


Measured memory_bytes: 1024
n = int(input())
x = list(map(int,input().split()))

li = [[0]*101 for _ in range(n)]

for i in range(n):
    for j in range(101):
        li[i][j] = (x[i] - j) ** 2

ans = 10 ** 10

for i in range(101):
    tmp = 0
    for j in range(n):
        tmp += li[j][i]
    ans = min(ans,tmp)

print(ans)


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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;
using P = pair<ll,ll>;
using grid = vector<vector<int>>;

const int dx[2] = {1, 0};
const int dy[2] = {0, 1};
const ll INF = 1LL<<60;
const ll mod[2] = {2147483647,2147483629};
const ll B[2] = {2147483624, 2147483627};

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    string S,T;
    cin>>S>>T;
    vector<ll> t(2,0);
    ll N = S.size(),M = T.size();
    vector<vector<ll>> v(2,vector<ll>(N,0));
    rep(k,2){
        ll po = 1LL;
        for(auto x:T){
            ll n = x - 'a';
            t[k] = ((t[k] * B[k])%mod[k] + n)%mod[k];
        }
        rep(i,M) po = (po * B[k])%mod[k];
        rep(i,M){
            ll n = S[i%N] - 'a';
            v[k][0] = ((v[k][0]*B[k])%mod[k] + n)%mod[k];
        }
        for(ll i = 1; i < N; i++){
            ll n = S[(i+M-1)%N] - 'a', m = S[i-1] - 'a';
            v[k][i] = ((v[k][i-1]*B[k])%mod[k] - (po*m)%mod[k] + n)%mod[k];
            if(v[k][i]<0) v[k][i] += mod[k];
        }
    }
    vector<ll> nex(N,INF);
    rep(i,N){
        if(v[0][i]==t[0]&&v[1][i]==t[1]) nex[i] = ((ll)i+M)%N;
    }
    bool ok = false;
    ll ans = 0LL;
    vector<bool> done(N,false);
    rep(i,N){
        if(done[i]) continue;
        done[i] = true;
        ll p = i;
        ll cnt = 0LL;
        while(nex[p]!=INF) {
            p = nex[p];
            done[p] = true;
            if(p==i) {
                ok = true;
                break;
            }
            cnt++;
        }
        chmax(ans,cnt);
        if(ok) break;
    }
    if(ok) cout<<-1<<endl;
    else cout<<ans<<endl;
}

Measured memory_bytes: 16144
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
#define PI 3.141592653589793
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const ll inf=1000000007;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<Pii> v[100001];
ll dp2[300000][60]={};
int main() {
	int n;
	cin>>n;
	int r=0;
	int m=200000;
	rep(i,n){
		int a;
		cin>>a;
		if(a<=m){
			r++;
			m=a;
		}
	}
	printf("%d",r);
	return 0;
}


Measured memory_bytes: 3968
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
if(a < 10 && b <10){
    System.out.println(a*b);
}else{
	System.out.println("-1");
}
	}
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
const int N = 3005;
long long dp[N][N];
long long a[N];
long long play(int l,int r){
    if(dp[l][r]!=-1) return dp[l][r];
    if(l==r)        return dp[l][r] = a[l];
    return dp[l][r] = max(a[l]-play(l+1,r),a[r]-play(l,r-1));
}
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)   scanf("%lld",&a[i]);
    memset(dp,-1,sizeof dp);
    printf("%lld\n",play(1,n));
    return 0;
}


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

ll gcd(ll a, ll b){
  if(b==0)return a;
  else gcd(b,a%b);
}
ll lcm(ll x,ll y){
  return x*y/gcd(x,y);
}


int main(){
 ll X,A;
  cin >> X >>A;
  cout <<( X<A ? 0:10) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll MOD=1e9+7;
const ll N=2e5+5;
const ld pi=3.14159265359;
const ll INF=(1LL<<62);
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(a) (ll)a.size()

ll n,d,a,ans,x,y,sum;
vector<pll> v;
deque<pll> seg;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n>>d>>a;
	REP(i,n){cin>>x>>y;v.pb(mp(x,y));}
	sort(v.begin(),v.end());
	for(auto j:v){
		while(SZ(seg)&&seg.front().X<j.X)sum-=seg.front().Y,seg.pop_front();
		j.Y-=sum;
      	if(j.Y<=0)continue;
		ans+=(j.Y+a-1)/a;sum+=(j.Y+a-1)/a*a;seg.pb(mp(j.X+2*d,(j.Y+a-1)/a*a));
	}
	cout<<ans<<"\n"; 
	return 0;
}




Measured memory_bytes: 6384
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

h,w,k = m()

s = [[0 for i in range(w)] for j in range(h)]
co = 1
for i in range(h):
    a = list(input())
    for j in range(w):
        if a[j] == "#":
            s[i][j] = co
            co += 1

for i in range(h):
    for j in range(w-1):
        if s[i][j+1] == 0:
            s[i][j+1] = s[i][j]

for i in range(h):
    for j in range(w-1,0,-1):
        if s[i][j-1] == 0:
            s[i][j-1] = s[i][j]

for j in range(w):
    for i in range(h-1):
        if s[i+1][j] == 0:
            s[i+1][j] = s[i][j]

for j in range(w):
    for i in range(h-1,0,-1):
        if s[i-1][j] == 0:
            s[i-1][j] = s[i][j]
for i in range(h):
    print(jo(s[i]))



Measured memory_bytes: 47088
package main

import "fmt"

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_6_A>
 */

func init() {
}

func main() {
	card := make([][]int, 4)
	for i := 0; i < 4; i++ {
		card[i] = make([]int, 13)
	}

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

	for i := 0; i < n; i++ {
		var c string
		var x int
		fmt.Scanf("%s %d", &c, &x)
		if c == "S" {
			card[0][x-1] = 1
		} else if c == "H" {
			card[1][x-1] = 1
		} else if c == "C" {
			card[2][x-1] = 1
		} else {
			card[3][x-1] = 1
		}
	}

	for i := 0; i < 4; i++ {
		for j := 0; j < 13; j++ {
			if card[i][j] == 0{
				if i == 0{
					fmt.Printf("S %d\n",j+1)
				}else if i == 1{
					fmt.Printf("H %d\n",j+1)
				}else if i == 2{
					fmt.Printf("C %d\n",j+1)
				}else{
					fmt.Printf("D %d\n",j+1)
				}
			}
		}
	}
}

Measured memory_bytes: 1136
n=int(input())
#a=[int(i) for i in input().split()]
t=[]
for i in range(n):
    t.append(int(input()))

def gcd(x,y):
    if x%y==0:
        return y
    while x%y!=0:
        x,y=y,x%y
    return y

ans=t[0]
for i in range(1,n):
    ans=ans*t[i]//gcd(ans,t[i])

print(ans)

Measured memory_bytes: 39664
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    string ans = "No";
    if (a == b && b == c) ans = "Yes";
    cout << ans << endl;
}

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

using namespace std;

int main() {
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    const double phi_h = 2 * M_PI * (h + m / 60) / 12.0;
    const double phi_m = 2 * M_PI * m / 60.0;
    double hx = a * cos(phi_h);
    double hy = a * sin(phi_h);
    double mx = b * cos(phi_m);
    double my = b * sin(phi_m);
    cout << setprecision(12) << hypot(hx - mx, hy - my) << "\n";
    return 0;
}


Measured memory_bytes: 4132
N, X, M = map(int, input().split())

idx = [-1] * M
A = []
total = 0
length = 0

while idx[X] == -1:
    A.append(X)
    idx[X] = length
    length += 1
    total += X
    X = pow(X, 2, M)

cycle = length - idx[X]
cycle_sum = sum(A[idx[X]:length])

ans = 0
if length >= N:
    print(sum(A[:N]))
else:
    ans += total
    N -= length
    l, m = divmod(N, cycle)
    ans += cycle_sum * l
    ans += sum(A[idx[X]:idx[X] + m])
    print(ans)


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int max1 = 0, max2 = 0, memo;
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
    if (max1 < a.at(i)) {
      max1 = a.at(i);
      memo = i;
    }
  }
  for (int i = 0; i < n; i++) {
    if (i == memo) continue;
    max2 = max(max2, a.at(i));
  }
  for (int i = 0; i < n; i++) {
    if (i == memo) cout << max2 << endl;
    else cout << max1 << endl;
  }
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
#define int long long int

int f(int n, int b){
	if(n<b)
		return n;
	return f(n/b, b) + (n%b); 
}

int32_t main(){
	int n,s;
	cin>>n>>s;
	int ans = 1e18;
	int diff = n-s;
	int sq = sqrt(diff);

	if(n==s){
		cout << n+1 << endl;
		return 0;
	}
	if(s>n){
		cout<<-1<<endl;
		return 0;
	}

	for(int i = 2;(i*i) <= n; i++){
		if(f(n,i) == s){
			cout << i << endl;
			return 0;
		}
	}

	bool pos = 0;
	
	for(int i=1; i <= sq; i++){
		if((diff % i) == 0){
			if(f(n, i + 1) == s){
				pos = 1;
				ans = min(ans, i + 1);
			}
			if(f(n, (diff / i) + 1) == s){
				pos = 1;
				ans = min(ans, (diff / i) + 1);
			}
		}
	}

	cout << (pos ? ans : -1) << endl;
}

Measured memory_bytes: 384
s=gets.chop
k=gets.to_i
res=''
i=0
s.bytes{|b|
    x=b-97
    if x>0 and k>=26-x
        res+=?a
        k-=26-x
    else
        res+=s[i]
    end
    i+=1
}
res[-1]=((res[-1].ord-97+k%26)+97).chr
puts res


Measured memory_bytes: 90604