akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
int a, b, c, go, siti;
  go = 0;
  siti = 0;
  cin >> a >> b >> c;
  
  if(a == 5) go++; else if (a == 7) siti++;
  if(b == 5) go++; else if (b == 7) siti++;
  if(c == 5) go++; else if (c == 7) siti++;
  
  if(go == 2 && siti == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define cases           int T;cin>>T;for(int TC=1;TC<=T;TC++)
#define FastRead        ios_base::sync_with_stdio(0)
#define power(n,i)      (long long)ceil(pow(n,i))
#define ABS(x)          ((x)<0?-(x):(x))
#define MAX(x,y,z)      max(max(x,y),z)
 
int w[105];
int c[105];
int N,W;
long long inf=10000000000;
long long dp[105][100005];
long long call(int i, int v)
{   
    if(i==N)
    {
        if(v==0)
            return 0;
        else
            return inf;
    }
    if(dp[i][v]!=-1)
      return dp[i][v];
 
    long long w1=inf,w2=inf;
    if(v-c[i]>=0)
        w1= call(i+1,v-c[i])+w[i];
    w2= call(i+1,v);
    return dp[i][v]=min(w1,w2);
}
int main()
{
 
   memset(dp,-1,sizeof(dp));
   cin>>N>>W;
   for(int i=0;i<N;i++)
      cin>>w[i]>>c[i];
    for(int i=100000;i>=1;i--)
    {
        long long ans=call(0,i);
        if(ans<=W)
        {
            cout<<i<<endl;
            break;
        }
    }
}

Measured memory_bytes: 82304
#include<iostream>
#include<vector>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	int pre = -999;
	rep(i, n) {
		if (pre <= a[i] - 1) {
			pre = a[i] - 1;
		}
		else if (pre <= a[i]) {
			pre = a[i];
		}
		else {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}



Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <fstream>
#include <bitset>
#include <cstdio>
#include <sstream>
#include <string>
#include <queue>
#include <map>
#include <stack>
#include <set>
#include <cctype>
#include <iomanip>
#include <list>
#include <cstring>

#define INF 2000000000
#define ull unsigned long long int
#define vi vector<int>
#define vii vector<ii>
#define int long long int

#define UNVISITED 0
#define OPENED 1
#define CLOSED 2

#define PI 3.14159265359

#define D(x) cout<<#x<<" : "<<x<<endl
#define P(x) cout << x << endl;

using namespace std;

int dp[1000][1000];

int fct(int x, int y) {

	if(x <= 1 && y <= 1) return 0;
	else if(dp[x][y] != -1) {
		return dp[x][y];
	}
	else {
		bool ok = false;
		for(int i= 1; 2*i <= x; i++) {
			ok |= (!fct(x - 2*i, y+i));
		}
		for(int i= 1; 2*i <= y; i++) {
			ok |= (!fct(x+i, y-2*i));
		}
		dp[x][y] = ok;
		return ok;
	}
}
signed main () {
	for(int i= 0; i < 1000; i++) for(int j= 0; j < 1000; j++) dp[i][j] = -1;
	

	
/*	for(int i= 0; i < 50; i++) {
		for(int j= 0; j < 50; j++) {
			fct(i, j);
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}*/

	int x, y; cin >> x >> y;
	if(abs(x-y) <= 1) cout << "Brown" << endl;
	else cout << "Alice" << endl;
	return 0;
}

Measured memory_bytes: 8064
N, M = map(int, input().split())
H = list(map(int, input().split()))
paths = [list(map(int, input().split())) for _ in range(M)]

d = {i + 1: [] for i in range(N)}
for p in paths:
    d[p[0]].append(H[p[1] - 1])
    d[p[1]].append(H[p[0] - 1])

ans = 0
for i in range(N):
    # i = 0
    hs = d[i + 1]
    if len(hs) == 0:
        ans += 1
        continue

    my_h = H[i]
    flag = True
    for h in hs:
        if h >= my_h:
            flag = False

    if flag:
        ans += 1

print(ans)


Measured memory_bytes: 112420
#include <iostream>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int main()
{
    int m,n,o,i,j,k;
    float f,g,h;
    //string a;
    //cin>>m;
    cin>>m>>n>>o>>i>>j>>k;
    //cin>>f>>g;
    if(j-m>k) cout<<":(";
    else cout<<"Yay!";
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;
import java.util.ArrayList;
import java.util.List;
//List<String> color = new ArrayList<>();
//int[] n = new int[k];

class Main {
	static void swap(int[] a, int idx1, int idx2) {
		int t = a[idx1];
		a[idx1] = a[idx2];
		a[idx2] = t; 
	}

	static void quicksort(int[] a, int left, int right) {
		int pl = left;
		int pr = right;
		int x = a[(pl + pr) / 2];

		do {
			while (a[pl] < x) pl++;
			while (a[pr] > x) pr--;
			if (pl <= pr)
				swap(a, pl++, pr--);
		}	while (pl <= pr);

		if (left < pr)
			quicksort(a, left, pr);
		if (pl < right)
			quicksort(a, pl, right);
	}

	static void quicksort2(int[] a, int n) {
		quicksort(a, 0, n - 1);
	}

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		int[] x = new int[m];
		for (int i = 0;i < m; i++)
			x[i] = stdIn.nextInt();
		int ans;
		int s = 0;
		if (n >= m)
			ans = 0;
		else {
			quicksort2(x, m);
			int[] y = new int[m-1];
			for (int i = 0; i < m-1; i++)
				y[i] = x[i+1] - x[i];
			quicksort2(y, m-1);
			for (int i = 0; i < m-n; i++)
				s = s + y[i];
			ans = s;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 51844
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
struct edge{
  int from,to;
  edge(){}
  edge(int from,int to):from(from),to(to){}
};
signed main(){
  const int MAX = 333;
  vector<vector<int> > G(MAX,vector<int>(MAX,0));
  auto D=G;
  map<string, int> R;
  int sz=0;
 
  {
    string p,q;
    cin>>p>>q;
    R[p]=sz++;
    R[q]=sz++;
  }
   
  int n;
  cin>>n;
  vector<vector<edge> > sG(n);
  vector<map<int,set<int> > > M(MAX);
   
  for(int i=0;i<n;i++){
    int m;
    cin>>m;
    for(int j=0;j<m;j++){
      string s,t;
      cin>>s>>t;
      if(!R.count(s)) R[s]=sz++;
      if(!R.count(t)) R[t]=sz++;
      sG[i].emplace_back(R[s],R[t]);
      M[R[s]][R[t]].insert(i);
    }
  }
 
  vector<int> used(n, 0);
  queue<edge> q;
  auto add_edge=[&](int from, int to){
    G[from][to]=1;
    q.emplace(from,to);
  };
  auto add=[&](int x){
    for(edge e:sG[x])
      add_edge(e.from,e.to);
  };
   
  add_edge(0,1);
   
  while(!q.empty()){
    edge e=q.front();q.pop();
    if(D[e.from][e.to]) continue;
    D[e.from][e.to]=1;
    //cout<<e.from<<" "<<e.to<<endl;
    for(int i:M[e.from][e.to]){
      if(used[i]) continue;
      used[i]=1;
      add(i);
    }
    for(int i=0;i<sz;i++){
      if(G[i][e.from]&&!D[i][e.to])   q.emplace(i,e.to);
      if(G[e.to][i]  &&!D[e.from][i]) q.emplace(e.from,i);
    }
  }
   
  for(int k=0;k<MAX;k++)
    for(int i=0;i<MAX;i++)
      for(int j=0;j<MAX;j++)
	G[i][j]|=G[i][k]&&G[k][j];
 
  for(int i=0;i<MAX;i++){
    if(!G[i][i]) continue;
    cout<<"No"<<endl;
    return 0;
  }
   
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 182384
using System;

namespace keyence19b
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            const string k = "keyence";
            int pos = 0;
            for (int i=0; i<k.Length; i++)
            {
                if (s[i] == k[i]) {
                    pos = i + 1;
                }
                else {
                    break;
                }
            }
            if (pos == k.Length) {
                Console.WriteLine("YES");
            }
            else {
                if (s.EndsWith(k.Substring(pos))) {
                    Console.WriteLine("YES");
                }
                else {
                    Console.WriteLine("NO");
                }
            }
        }
    }
}

Measured memory_bytes: 13396
# def makelist(n, m):
#     return [[0 for i in range(m)] for j in range(n)]

N, X = map(int, input().split())
x = [X] + list(map(int, input().split()))

# ユークリッドの互除法
def gcd(a, b):  # a >= b
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

    
x.sort()
sa = [0]*(N)
for i in range(N):
    sa[i] = x[i+1] - x[i]
    
for i in range(1, N):
    sa[i] = gcd(sa[i-1], sa[i])

print(sa[-1])


Measured memory_bytes: 14224
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include <bits/stdc++.h> 
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  ll ans=0;
  ll x=tx-sx,y=ty-sy;
  rep(i,y)cout << 'U';
  rep(i,x+1)cout << 'R';
  rep(i,y+1)cout << 'D';
  rep(i,x+1)cout << 'L';
  cout << 'U';
  cout << 'L';
  rep(i,y+1)cout << 'U';
  rep(i,x+1)cout << 'R';
  rep(i,y+1)cout << 'D';
  rep(i,x)cout << 'L';
return 0;}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <cstring>
typedef long long ll;
using namespace std;
inline int read()
{
	int f=1,k=0;char c=getchar();
	while (c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
	while (c>='0'&&c<='9')k=k*10+c-'0',c=getchar();
	return k*f;
}
const int maxn=2e5+100;
int sum[maxn];
char s[maxn];
signed main()
{
	int n=read();
	scanf("%s",s+1);
	for(int i=1;i<=n;i++)if(s[i]=='.')sum[0]++;else sum[1]++;
	int cnt=sum[0],ans=cnt;
	for(int i=1;i<=n;i++){
		if(s[i]=='.')cnt--;else cnt++;
		ans=min(ans,cnt);
	}
	cout<< ans<<endl;
								  
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define LL long long
#define db long double

using namespace std;
const int N=1e6+10,inf=1e9;
int rd()
{
    int x=0,w=1;char ch=0;
    while(ch<'0'||ch>'9'){if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+(ch^48);ch=getchar();}
    return x*w;
}
int to[N],nt[N],c[N],hd[N],tot=1;
void adde(int x,int y,int z)
{
    ++tot,to[tot]=y,nt[tot]=hd[x],c[tot]=z,hd[x]=tot;
    ++tot,to[tot]=x,nt[tot]=hd[y],c[tot]=0,hd[y]=tot;
}
int ps,pt,lv[N],nhd[N];
queue<int> q;
bool bfs()
{
    memset(lv,0,sizeof(int)*(pt+1));
    lv[ps]=1,q.push(ps);
    while(!q.empty())
    {
	int x=q.front();
	q.pop();
	for(int i=hd[x];i;i=nt[i])
	{
	    int y=to[i];
	    if(c[i]>0&&!lv[y])
		lv[y]=lv[x]+1,q.push(y);
	}
    }
    return lv[pt];
}
int dfs(int x,int fw)
{
    if(x==pt) return fw;
    int an=0;
    for(int &i=nhd[x];i;i=nt[i])
    {
	int y=to[i];
	if(c[i]>0&&lv[y]==lv[x]+1)
	{
	    int dt=dfs(y,min(c[i],fw));
	    c[i]-=dt,c[i^1]+=dt;
	    fw-=dt,an+=dt;
	    if(!fw) break;
	}
    }
    return an;
}
int dinic()
{
    int an=0;
    while(bfs())
    {
	memcpy(nhd,hd,sizeof(int)*(pt+1));
	an+=dfs(ps,inf);
    }
    return an;
}
int n,an[N][2],ta,fe[N],mat[N],mk[N];
bool v[N];
void dd(int x)
{
    v[x]=1;
    for(int i=hd[x];i;i=nt[i])
    {
	int yy=to[i]-n,y=mat[to[i]];
	if(!y||v[y]||c[i]) continue;
	++ta,an[yy][0]=x,an[yy][1]=y;
	dd(y);
    }
}

int main()
{
    ////////
    n=rd();
    ps=0,pt=n+n;
    for(int i=1;i<n;++i)
    {
	adde(ps,i+n,1);
	int t=rd();
	while(t--) adde(i+n,rd(),1);
    }
    for(int i=1;i<=n;++i) adde(i,pt,1),fe[i]=tot;
    if(dinic()<n-1){puts("-1");exit(0);}
    for(int i=1;i<n;++i)
    {
	for(int j=hd[i+n];j;j=nt[j])
	{
	    int y=to[j];
	    if(!c[j]&&y>=1&&y<=n){mat[i+n]=y,mk[y]=1;break;}
	}
    }
    int rt=1;
    while(mk[rt]) ++rt;
    dd(rt);
    if(ta<n-1){puts("-1");return 0;}
    for(int i=1;i<=ta;++i) printf("%d %d\n",an[i][0],an[i][1]);
    return 0;
}
 


Measured memory_bytes: 33536
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt(), k = scanner.nextInt();
			int[] h = IntStream.range(0, n).map(i -> scanner.nextInt()).sorted().toArray();
			System.out.println(IntStream.rangeClosed(0, n - k).map(i -> h[i + k - 1] - h[i]).min().getAsInt());
		}
	}
}


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

#include <stdio.h>
//#include <string.h>
#include <string>
/********
*	?????£?????????
*********/	
/*********??¢?????´?????????
*	(1)??????????????\???
*	(2)????????????????????????
*********/

int main(void)
{
	string cards;
	string left;
	string right;
	const char *end = "-";
	int n; //n???????????????????±±????????£?????????
	int h; //?????????h??????????????????
	int m; //?????£?????????????????°
	
	
	while(1){
		cin >> cards;
		if(cards.compare(end) ==0 ) {
			break;
		}
		n = cards.length();		//?????????.????????????
		
		scanf("%d\n", &m);
		
		for (int i=0; i< m; i++ ){
			scanf("%d\n", &h);
//			cout << cards << m << n << h;
			string left  = cards.substr(0, h);
			string right = cards.substr(h , (n-h));
			 cards = right  +  left;
			
		}
		cout << cards << endl;
	}
	
	return 0;
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
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; }
//template end



int main(){
   int n,k; scanf("%d%d",&n,&k);
   printf("%d\n",k+max(0,100*(10-n)));
   return 0;
}

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

int main(){
  double b,c,h,m;
  cin >> b >> c >> h >> m;
  double theta1 = 2 * M_PI * (m/60);
  double theta2 = 2 * M_PI * (h/12) + (m/60) * M_PI / 6;
  double theta = abs(theta1 - theta2);
  double a_a = b*b + c*c - 2* b* c * cos(theta);
  cout<<fixed<<setprecision(20)<<sqrt(a_a)<<endl;
}



Measured memory_bytes: 4288
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector> 
#include <set>
#include <cstdlib>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxN = 1000010;

int a[maxN];
int gcd(int a,int b)
	{
		return b?gcd(b,a%b):a;
	}

int main()
{
	int n,k; 
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	sort(a+1,a+1+n);
	if(k > a[n])
	{
		printf("IMPOSSIBLE\n");
		return 0;
	}
	int ans = gcd(a[1],a[2]);
	for(int i=1;i<n;i++)
	{
		int tmp = gcd(a[i],a[i+1]);
		ans = gcd(ans,tmp);
	}
	if(k%ans == 0)
	{
		printf("POSSIBLE\n");
		return 0;
	}
	for(int i=1;i<=n;i++)
		a[i] = a[i]/ans;
	k/=ans;
	if(k > a[n])
	{
		printf("IMPOSSIBLE\n");
		return 0;
	}
	if(ans ==1 || ans== k)
		printf("POSSIBLE\n");
	else
		printf("IMPOSSIBLE\n");
	return 0; 
}

Measured memory_bytes: 640
// C - A x B + C
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rp(i,s,e) for(ll i=(ll)(s);i<(ll)(e);++i)

int main(){
	ll n; cin>>n;
	ll cnt = 0;
	rp(a, 1, n){ // a:[1,n-1]
		ll m = (n-1) / a;
		rp(b, 1, m+1){ // b:[1,m]
			if(n <= a*b) break;
			cnt++;
		}
	}
	cout<< cnt <<endl;
}


Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ulong = unsigned long;
using ll = long long;
const int M = 1e9 + 7;
#pragma unused(M)

int main(){
	int n, a, b;
	string s;
	cin >> n >> a >> b >> s;
	int cnt = 0, pass = 0;
	for(int i=0;i<n;i++){
		switch(s[i]){
			case 'a':
				if(pass < a + b){
					cout << "Yes" << endl;
					pass++;
				}else{
					cout << "No" << endl;
				}
				break;
			case 'b':
				if(pass < a + b && cnt < b){
					cout << "Yes" << endl;
					pass++;
					cnt++;
				}else{
					cout << "No" << endl;
				}
				break;
			case 'c':
				cout << "No" << endl;
				break;
		}
	}
	return 0;
}



Measured memory_bytes: 1336
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long k = sc.nextLong();
		long a = sc.nextLong();
		long b = sc.nextLong();

		long deff = b-a;

		if(deff <= 2) {
			// 2以下ならたたき続けたほうがいい
			System.out.println(k + 1);
			return;
		}

		long cookie = 1;

		for(int i = 0; i < k; i++) {
			if(i == k-1){
				// 最後の一回はたたくしかない
				cookie++;
			} else if(cookie >= a) {
				// 2手使ってab変換
				cookie += deff;
				i++;
			} else {
				// たたく
				cookie++;
			}
		}

		System.out.println(cookie);

	}

}


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

int main() {
    string T;

    cin >> T;

    for (ll i=0;i<T.size(); i++){
        if (T.at(i) == '?'){
            T.at(i) = 'D';
        }
    }

    cout << T << endl;

}


Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define int ll
int32_t main(){
   int n, k;
   cin>>n>>k;
   int val = k;
   for(int i = 0; i<n-1; i++)val*=k-1;
   cout<<val<<endl;
}



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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

using namespace std;

template <typename T> T &chmin(T &a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T &a, const T &b) {return a = max(a, b);}

using ll = long long;
using ld = long double;

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);

int target[100005];
int dist[100005];

int main(){
  int n, m;
  cin >> n >> m;
  REP(i, m) cin >> target[i];
  sort(target, target+m);
  REP(i, m-1) dist[i] = target[i+1]-target[i];
  sort(dist, dist+m-1);
  int res = 0;
  REP(i, m-n) res += dist[i];
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1024
/*
***************************************************************************
 name  : ITP1_05_C.cpp
 title : Print a Chessboard
 make  : 2018/08/15 tanabe
***************************************************************************
*/

// Library
#include <iostream> // standard input output object

main(void){
  int h; // height
  int w; // width
  int l; // line
  int c; // column
  int s; // sum

   // initialized input "h w"
  // continue h != 0 or w != 0
  // input "h w" at loop update
  for(std::cin >> h >> w;h || w;std::cin >> h >> w){
    // initialized l = 0
    // continue l < h
    // increment l at loop update
    for(l = 0;l < h;l++){
      // initialized c = 0
      // continue c < w
      // increment c at loop update
      for(c = 0;c < w;c++){
        s = l+c;
        if(s%2 == 0){
          std::cout << "#"; // output "#"
        }
        else{
          std::cout << "."; // output "."
        }
      }
      std::cout << std::endl; // new line
    }
    std::cout << std::endl; // new line
  }

}



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

using namespace std;

int main()
{
    vector <int> a(5);
    for(int& x : a) cin >> x;
    sort(a.begin(), a.end());

    int Ans = 1e9;

    do
    {
        int Res = 0;

        for(int x : a)
        {
            while(Res % 10) Res++;

            Res += x;
        }

        Ans = min(Ans, Res);

    }while(next_permutation(a.begin(), a.end()));

    cout << Ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        sc.close();
        for(int i = 1; i <10; i++){
            if(N <= 111 * i){
                System.out.println(111 * i);
                break;
            }
        }

    }

}


Measured memory_bytes: 21844
#include <stdio.h>

int bubbleSort(int A[],int N){
  int c=0,j,a;
  int flag=1;

  while(flag){
    flag=0;
    for(j=N-1;j>0;j--){
      if(A[j]<A[j-1]){
	a=A[j];
	A[j]=A[j-1];
	A[j-1]=a;
	flag=1;
	c++;
      }
    }
  }
  return c;
}

int main(){
  int A[100],N,c,i;

  scanf("%d",&N);
  while(N<1||N>100){
    scanf("%d",&N);
  }

  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }

  c=bubbleSort(A,N);

  for(i=0;i<N;i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  
  printf("\n%d\n",c);

  return 0;
}



Measured memory_bytes: 2140
//解説版
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <vector>
using namespace std;
int main(){
    int x; cin>>x;
    int a=x/500;
    int ans1=x-a*500;
    int b=ans1/5;

    cout<<1000*a+5*b<<endl;
    return 0;
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long

using namespace std;

typedef pair<int, int> P;

ll max(ll a, ll b){
	if (a > b) {return a;}
	else {return b;}
}

int main(){
	ll n;
	cin >> n;
	vector<ll> x(n);
	vector<ll> y(n);
	vector<ll> h(n);
	REP(i, n){cin >> x[i] >> y[i] >> h[i];}
	ll not0_i;
	REP(i, n){if (!h[i]==0){not0_i = i; break;}}
	ll h0;
	REP(x0, 101){
		REP(y0, 101){
			h0 = h[not0_i] + abs(x0 - x[not0_i])+ abs(y0 - y[not0_i]);
			bool is_ans = true;
			REP(i, n){
				if (!(h[i] == max(0, h0 - abs(x0 - x[i]) - abs(y0 - y[i])))){
					is_ans = false; break;
				}
			}
			if (is_ans){cout << x0 << " " << y0 << " " << h0 << endl; return 0;}
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool vis[26];

int main()
{
    string ss,s;
    cin >> s;
    if(s.size()<26)
    {
        for(int i=0;i<s.size();i++)
            if(!vis[s[i]-'a'])
                vis[s[i]-'a']=true;
        cout << s;
        for(int i=0;i<26;i++)
        {
            if(!vis[i])
            {
                printf("%c\n",i+'a');
                break;
            }
        }
        return 0;
    }
    bool flag=false;
    for(int i=s.size()-2;i>=0;i--)
    {
        if(s[i]<s[i+1])
        {
            flag=true;
            break;
        }
    }
    if(!flag)
    {
        cout << -1 << endl;
        return 0;
    }
    ss=s;
    next_permutation(s.begin(),s.end());
    for(int i=0;i<s.size();i++)
    {
        cout << s[i];
        if(ss[i]<s[i])
            break;
    }
    puts("");
    return 0;
}


Measured memory_bytes: 256
x, k, d = map(int, input().split())

cnt = abs(x) // d
if k < cnt:
    ans = abs(x) - d * k
else:
    k -= cnt
    if k % 2:
        ans = d * (cnt + 1) - abs(x)
    else:
        ans = abs(x) - d * cnt

print(ans)


Measured memory_bytes: 9104
def exchange(btc):
  return 380000.0 * btc
 
n = int(input())
sum = 0.0
for i in range(n):
  a, b = input().split()
  if "JPY" in b:
    sum += float(a)
  else:
    sum += exchange(float(a))
 
print(sum)

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

ll modinv(ll a) {
  ll M = MOD, b = M, u = 1, v = 0;
  while (b)
    u -= a / b * v, swap(u, v), a %= b, swap(a, b);
  return (u % M + M) % M;
}

void solve() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  rep (i, N) cin >> A[i];

  unordered_map<ll, ll> yakusu;

  rep (i, N) {
    unordered_map<ll, ll> aaa;
    ll tmp = A[i];
    for (ll j = 2; tmp > 1; j++) {
      if (j * j > A[i]) {
        aaa[tmp]++;
        tmp = 1;
        break;
      }
      while (tmp % j == 0) {
        aaa[j]++;
        tmp /= j;
      }
    }
    for (auto it: aaa) {
      yakusu[it.first] = max(yakusu[it.first], it.second);
    }
  }

  ll lcm = 1;
  for (auto it: yakusu) {
    rep (i, it.second) {
      lcm *= it.first;
      lcm %= MOD;
    }
  }

  ll ans = 0;
  rep (i, N) {
    ll tmp = lcm;
    tmp *= modinv(A[i]);
    tmp %= MOD;
    ans += tmp;
    ans %= MOD;
  }

  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 768
def int_sum(x):
    y=str(x)
    num=0
    for i in range(len(y)):
        num += x%10
        x = x//10
    return num

n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
    if a<=int_sum(i) and int_sum(i)<=b:
        ans +=i
print(ans)

Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
  	cin>>n;
  	int od=n%10;
  	if(od==0||od==6||od==1||od==8){cout<<"pon";}
  	if(od==2||od==4||od==5||od==7||od==9){cout<<"hon";}
  	if(od==3){cout<<"bon";}
 }

Measured memory_bytes: 3572
#include <algorithm>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <stack>
#include <string>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
//const int INF = INT_MAX/3;

/*------------------------------------------------------------------------------*/

int main(){
  string s, c = "CODEFESTIVAL2016";

  cin >> s;

  int ans = 0;

  REP(i, 0, s.size()){
    if(s[i] != c[i]){
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
long long n, x=2, y=2, a[100005];
int main() {
	int i;
	scanf("%lld", &n);
	for(i=0; i<n; i++) scanf("%lld", a+i);
	for(i=n-1; i>=0; i--) {
		x = (x+a[i]-1) / a[i] * a[i];
		y = y / a[i] * a[i] + a[i]-1;
		if(x>y) {puts("-1"); return 0;}
	}
	printf("%lld %lld", x, y);
	return 0;
}

Measured memory_bytes: 896
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
    n: usize,
    l: [usize; n]
    }
    let s = l.iter().sum::<usize>();
    let m = l.iter().max().unwrap();
    let ans = if *m < s - *m {"Yes"} else {"No"};
    println!("{}", ans);
}


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


using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;


vector<vector<int>> w;


void f(int n, int k,int now, int cnt,vector<int> v) {
	if (now == n)return;
	f(n, k, now + 1, cnt, v);
	vector<int> a = v;
	a.push_back(now);
	if (cnt + 1 == k) {
		w.push_back(a);
		return;
	}
	f(n, k, now + 1, cnt + 1, a);
}


int main() {

	int n;
	cin >> n;
	vector<int> a(n), b(n);
	REP(i, n)cin >> a[i];
	REP(i, n)cin >> b[i];
	vector<int> c = {};
	f(n, (n + 1) / 2, 0, 0, c);


	int ans = INF;



	REP(i, w.size()) {
		bool check = false;
		bool d[18];
		REP(j, 18)d[j] = false;
		int counter = 0;
		REP(j, w[i].size()) {
			d[w[i][j]] = true;
			counter++;
		}
		vector<pair<int, int>> e, ff;
		REP(j, n) {
			int z;
			if ((j % 2 == 1 && !d[j]) || (j % 2 == 0 && d[j])) {
				z = a[j];
			}
			else {
				z = b[j];
			}
			if (d[j])e.push_back({ z,j });
			else ff.push_back({ z,j });
		}
		sort(ALL(e));
		sort(ALL(ff));

		int tmp = -1;

		vector<int> an;
		REP(i, n / 2) {
			if (e[i].first >= tmp)tmp = e[i].first;
			else {
				check = true;
				break;
			}
			if (ff[i].first >= tmp)tmp = ff[i].first;
			else {
				check = true;
				break;
			}
			an.push_back(e[i].second);
			an.push_back(ff[i].second);
		}
		if (n % 2) {
			if (e[e.size() - 1].first < tmp)check = true;
			an.push_back(e[e.size() - 1].second);
		}
		if (check)continue;



		int cnt = 0;
		REP(i, n - 1) {
			for (int j = n - 1; j > i; j--) {
				if (an[j - 1] > an[j]) {
					swap(an[j], an[j - 1]);
					cnt++;
				}
			}
		}

		ans = min(ans, cnt);
	}

	if (ans == INF) {
		cout << -1 << endl;
	}
	else {
		cout << ans << endl;
	}

	


}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int[] n = {1, 1, 0, 2, 0, 0, 1, 0, 1, 0};
		int a = sc.nextInt() % 10;

		System.out.println(n[a] == 0 ? "hon" : n[a] == 1 ? "pon" : "bon");
	}
}

Measured memory_bytes: 35688
// ABC104
// A - Rated for Me
#include<bits/stdc++.h>

using namespace std;

int main(){
    int r;
    cin >> r;
    if(r<1200) cout << "ABC" << endl;
    else if(r<2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;
    return 0;
}


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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define MOD 1000000007;

int main() {
    int n;
    cin >> n;
    //vector<int> numCount(n, 0);
    int numCount[100100] = {0};
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        numCount[x]++;
    }

    int ans = 1;
    if (n % 2 == 0) { // 要素数が偶数の時
        for (int i = 1; i < n; i+=2) {
            if (numCount[i] != 2) {
                cout << "0" << endl;
                return 0;
            }
            (ans *= 2) %= MOD;
        }
    } else { // 要素数が奇数
        if (numCount[0] != 1) {
            cout << "0" << endl;
            return 0;
        }
        for (int i = 2; i < n; i+=2) {
            if (numCount[i] != 2) {
                cout << "0" << endl;
                return 0;
            }
            (ans *= 2) %= MOD;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#define N 500000
#define INFTY 1000000001;

void merge(int *,int,int,int);
void mergeSort(int *,int,int);
int count=0;

int main(){
  int n,S[N],i;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  mergeSort(S,0,n);
  for(i=0;i<n;i++){
    if(i) printf(" ");
    printf("%d",S[i]);
  }
  printf("\n%d\n",count);
  return 0;
}

void merge(int A[],int left,int mid,int right){
  int i,j,k,n1,n2,*L,*R;
  n1 = mid - left;
  n2 = right - mid;
  L=(int *)malloc((n1+1)*sizeof(int));
  R=(int *)malloc((n2+1)*sizeof(int));
  for (i = 0 ;i< n1;i++) L[i] = A[left + i];
  for (i = 0 ;i< n2;i++) R[i] = A[mid + i];
  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;
  for (k = left ;k< right;k++){
    if (L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else {
      A[k] = R[j];
      j++;
    }
    count++;
  }
}
	
void mergeSort(int A[],int left,int right){
  int mid;
  if (left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}
	



Measured memory_bytes: 64440
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] d = new int[n+1];
		for(int i=0;i<n;i++) {
			d[i+1] = sc.nextInt();
		}
		d[0] = 0;
		for(int i=12;i>=0;i--) {
			if (check(n+1,d,i)) {
				System.out.println(i);
				return;
			}
		}
		System.out.println(0);
	}

	public static boolean check(int n,int[] d, int k) {
		int[][] m = new int[n][n];
		for(int i=0;i<n;i++) {
			for(int j=0;j<n;j++) {
				if (i == j) continue;
				boolean same = Math.abs(d[i]-d[j]) >= k;
				boolean diff = Math.min(d[i] + d[j], 24 - d[i] - d[j]) >= k;
				if (!same && !diff) {
					return false;
				}
				if (same && diff) {

				}else if(same){
					m[i][j] = m[j][i] = 1;
				}else{
					m[i][j] = m[j][i] = -1;
				}
			}
		}
//		System.out.println(Arrays.deepToString(m));
		int[] sgn = new int[n];
		boolean ok = true;
		try {
			for(int i=0;i<n;i++) {
				if (sgn[i] == 0) {
					sgn[i] = 1;
					dfs(i,n,m,sgn);
				}
			}
		}catch (RuntimeException e) {
			ok = false;
		}
		return ok;

		//return (a <= i && i < b) || (a <= i + 24 && i + 24 < b);
	}

	public static void dfs(int v, int n, int[][] m, int[] sgn) {
		for(int u=0;u<n;u++) {
			if (v==u || m[v][u] == 0) continue;
			int sgn2 = sgn[v] * m[v][u];
			if (sgn[u] != 0) {
				if (sgn[u] != sgn2) {
					//fail
					throw new RuntimeException();
				}
			}else{
				sgn[u] = sgn2;
				dfs(u,n,m,sgn);
			}
		}
	}


}

Measured memory_bytes: 24916
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int h1 = scan.nextInt();
        int h2 = scan.nextInt();
        int k1 = scan.nextInt();
        int k2 = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int d = scan.nextInt();

        int h = h1 * a + (h1 / 10 * c) + h2 * b + (h2 / 20 * d);
        int k = k1 * a + (k1 / 10 * c) + k2 * b + (k2 / 20 * d);
        
        if (h > k) {
            System.out.println("hiroshi");
        }
        if (h < k) {
            System.out.println("kenjiro");
        }
        if (h == k) {
            System.out.println("even");
        }

    }
}



Measured memory_bytes: 26216
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
int h,w;
char a[411][411];
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
bool used[411][411];
int ans=0;
int white;
int black;
bool allused[411][411];
void dfs(int x,int y){
	used[x][y]=true;
	allused[x][y]=true;
	if(a[x][y]=='.')white++;
	else black++;
	rep(i,4)if(a[x][y]!=a[x+dx[i]][y+dy[i]]&&!used[x+dx[i]][y+dy[i]]&&(a[x+dx[i]][y+dy[i]]=='#'||a[x+dx[i]][y+dy[i]]=='.'))dfs(x+dx[i],y+dy[i]);
}
signed main(){
	cin>>h>>w;
	for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)cin>>a[i][j];
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(a[i][j]=='.')continue;
			if(allused[i][j])continue;
			white=0;
			black=0;
			dfs(i,j);
			ans+=white*black;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int main(){
  int N,cnt=0;
  cin>>N;
  int p[N];
  for(int i=0;i<N;i++){
   cin>>p[i] ;
  }
  for(int i=0;i<N;i++) {
    if(i+1==p[i]) continue;
    else{
     int num=p[i];
     if(i+1==p[num-1]){
       cnt++;
       continue;
     }
     else {
       cout<<"NO\n";
       return 0;
     }
    }
  }
  if(cnt==2||cnt==0){
      cout<<"YES\n";
    }
    else cout<<"NO\n";
  
 return 0; 
}

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

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

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int dx = tx - sx;
    int dy = ty - sy;

    rep(dx) cout << 'R';
    rep(dy) cout << 'U';
    rep(dx) cout << 'L';
    rep(dy) cout << 'D';
    cout << 'L';
    rep(dy + 1) cout << 'U';
    rep(dx + 1) cout << 'R';
    cout << 'D';
    cout << 'R';
    rep(dy + 1) cout << 'D';
    rep(dx + 1) cout << 'L';
    cout << 'U' << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 9223372036854775807;
const ll half_inf = 0x3f3f3f3f;
const ll inf = 0x7fffffff;
const ll mod = 998244353;
const ll maxn = 2000005;
int a[1005];
int main(){  
	cin.tie(0);
    ios::sync_with_stdio(false);
	int n,m,k,b,c,sum=0;
	scanf("%d%d",&n,&m); 
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	sort(a+1,a+n+1);
	if(a[n-m+1]*4*m>=sum) printf("Yes");
	else printf("No");
    return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstring>
#include<iomanip>
using namespace std;
typedef long long ll;
#define ip(arr, n) for(int i=1; i<=n; i++) cin>>arr[i];
#define op(arr, n) for(int i=0; i<n; i++) cout<<arr[i]<<" ";
#define fstIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MAX 3000

ll n;
double arr[MAX];
double dp[MAX][MAX];
// dp[i][j] -> probability of getting j heads with i coins tosses.

double solve(int coins, int heads_req){
    if(heads_req == 0){//now we req 0 head, so to get 0 heads out of 0 or more coins is always 1
        return 1;
        // assume mera pass 5 coins hai mein toss kiya unse kinte aise coins honge jisme kam se kam 
        // 0 head aya hoo (matlab head ho ya na ho koi farak nahu padta) sare coins hi honge
        // so it will give 1
    }
    if(coins == 0){// now we don't have any coins, but still we need more head_req heads
        return 0;
        // basically assume tera pass 0 coins hai and tune unhe toss kiya abb head_req head ane ki
        // possibility kya hogi, 0 qki coins hi nahi rahe toh head hi nahi a sakte
    }

    if(dp[coins][heads_req] > -1) return dp[coins][heads_req];

    double opt1 = arr[coins]*solve(coins-1, heads_req-1);
    double opt2 = (1-arr[coins])*solve(coins-1, heads_req);

    dp[coins][heads_req]=opt2+opt1;
    return dp[coins][heads_req];
}
int main(){
    cin>>n;
    ip(arr, n);
    memset(dp, -1, sizeof(dp));
    cout<<fixed<<setprecision(11)<<solve(n, (n+1)/2)<<endl;
    return 0;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A.at(i);
    deque<ll> d;
    rep(i, N){
        ll p = lower_bound(all(d), A.at(i)) - d.begin();
        if(p == 0){
            d.push_front(A.at(i));
        }
        else{
            d.at(p-1) = A.at(i);
        }
    }
    cout << sz(d) << endl;    
}

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

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
string s[105];
ll n,m;
ll ans;
ll dp[105][105];
bool valid(ll x,ll y){
    if(x<0 || y<0 || x>=n || y>=m) return 0;
    return 1;
}
ll get(ll x,ll y){
    if(x==n-1 && y==m-1) return dp[x][y]=0;
    if(dp[x][y]!=hell) return dp[x][y];
    ll &curr=dp[x][y];
    // curr=hell;
    if(valid(x+1,y)){
        if(s[x][y]=='.' && s[x+1][y]=='#') curr=min(curr,1+get(x+1,y));
        else curr=min(curr,get(x+1,y));
    }
    if(valid(x,y+1)){
        if(s[x][y]=='.' && s[x][y+1]=='#') curr=min(curr,1+get(x,y+1));
        else curr=min(curr,get(x,y+1));
    }
    return curr;
}
void solve(){
    cin>>n>>m;
    rep(i,0,n-1) cin>>s[i];
    ans=0;
    if(s[0][0]=='#') ans++;
    // if(s[n-1][m-1]=='#') ans++;
    // memset(dp,1e5,sizeof(dp));
    rep(i,0,n-1) rep(j,0,m-1) dp[i][j]=hell;
    // dp[n-1][m-1]=0;
    ans+=get(0,0);
    // rep(i,0,n-1) rep(j,0,m-1) cout<<dp[i][j]<<" \n"[j==m-1];
    cout<<ans<<endl;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

Measured memory_bytes: 384
N = int(input())
xy = [[int(i) for i in input().split()] for i in range(N)]
xy = sorted(xy)
#xy = list(map(list, set(map(tuple, xy))))

d = {}
m = 0
for i in range(N):
    for j in range(i+1, N):
        a, b = xy[i][0]-xy[j][0], xy[i][1]-xy[j][1]
        if (a, b) in d:
            d[a, b] += 1
        else:
            d[a, b] = 1

for val in d.values():
    m = max(m, val)
#print(d)
print(N-m)


Measured memory_bytes: 39024
N = int(input())
T = []
for i in range(N):
    t=int(input())
    T.append(t)

import fractions

T.sort(reverse=True)
ans = T[0]
for i in range(1,N):
    gcd = fractions.gcd(ans,T[i])
    ans = (ans*T[i])//gcd
print(ans)

Measured memory_bytes: 5048
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 60;
char s[2][N];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < 2; ++i) {
    scanf("%s", s[i]);
  }
  int64 ret;
  if (s[0][0] == s[1][0]) {
    ret = 3LL;
    int prev = 1;
    for (int k = 1; k < n; ) {
      if (s[0][k] == s[1][k]) {
        if (prev == 1) {
          ret = ret * 2 % MOD;
        }
        prev = 1;
        k += 1;
      } else {
        if (prev == 1) {
          ret = ret * 2 % MOD;
        } else {
          ret = ret * 3 % MOD;
        }
        prev = 0;
        k += 2;
      }
    }
  } else {
    ret = 6LL;
    int prev = 0;
    for (int k = 2; k < n; ) {
      if (s[0][k] == s[1][k]) {
        if (prev == 1) {
          ret = ret * 2 % MOD;
        }
        prev = 1;
        k += 1;
      } else {
        if (prev == 1) {
          ret = ret * 2 % MOD;
        } else {
          ret = ret * 3 % MOD;
        }
        prev = 0;
        k += 2;
      }
    }
  }
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

int main(){
    ll n; cin>>n;
    cout<<800*n-200*(n/15)<<endl;
}



















































Measured memory_bytes: 256
# input
n, m, c = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)
ans = 0

# main
n.times do
  a = gets.chomp.split.map(&:to_i)
  solved = 0
  m.times do |i|
    solved += a[i] * b[i]
  end
  if solved + c > 0 then
    ans += 1
  end
end
  
# output
puts ans


Measured memory_bytes: 1788
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_STORE_MAX		100										// 最大店数
#define D_PTN_CNT		10										// パターン数

// 内部変数
static int siSCnt;												// 店数
static int si2Open[D_STORE_MAX][D_PTN_CNT];						// 開店情報
static int si2Money[D_STORE_MAX][D_PTN_CNT + 1];				// 利益情報
static int siMax;												// 最大値

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// 最大値セット
int
fSetMax(
	int piPCnt					// <I> セット済開店パターン数
	, int *pipPtn				// <I> 開店パターン
)
{
	int i, j;

	// 終了チェック
	if (piPCnt == D_PTN_CNT) {

		// 開店パターンチェック
		for (i = 0; i < D_PTN_CNT; i++) {
			if (pipPtn[i] == 1) {
				break;
			}
		}
		if (i == D_PTN_CNT) {				// 開店なし
			return 0;
		}

		// 利益取得
		int liSum = 0;
		for (i = 0; i < siSCnt; i++) {

			// 同時開店数
			int liMatch = 0;
			for (j = 0; j < D_PTN_CNT; j++) {
				if (pipPtn[j] == 1) {
					if (si2Open[i][j] == 1) {
						liMatch++;
					}
				}
			}

			// 利益加算
			liSum += si2Money[i][liMatch];
		}

		// 最大値更新
		if (siMax < liSum) {
			siMax = liSum;
		}

		return 0;
	}

	// 開店選択
	pipPtn[piPCnt] = 1;
	fSetMax(piPCnt + 1, pipPtn);

	// 閉店選択
	pipPtn[piPCnt] = 0;
	fSetMax(piPCnt + 1, pipPtn);

	return 0;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i, j;
	char lc1Buf[1024], lc1Out[1024];

	// データ初期化
	siMax = INT_MIN;											// 最大値

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 店数取得
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d", &siSCnt);

	// 開店情報取得
	for (i = 0; i < siSCnt; i++) {
		for (j = 0; j < D_PTN_CNT; j++) {
#ifdef D_TEST
			fscanf(szpFpT, "%d", &si2Open[i][j]);
#else
			fscanf(stdin, "%d", &si2Open[i][j]);
#endif
		}
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
		fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	}

	// 利益情報取得
	for (i = 0; i < siSCnt; i++) {
		for (j = 0; j < D_PTN_CNT + 1; j++) {
#ifdef D_TEST
			fscanf(szpFpT, "%d", &si2Money[i][j]);
#else
			fscanf(stdin, "%d", &si2Money[i][j]);
#endif
		}
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
		fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	}

	// 最大値セット
	int li1Ptn[D_PTN_CNT];
	fSetMax(0, li1Ptn);

	// 結果セット
	sprintf(lc1Out, "%d\n", siMax);

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
long n,a,b[7],i;
while(cin>>n){
if(n==0)break;
for(i=0;i<7;i++)b[i]=0;
for(i=0;i<n;i++){
cin>>a;
if(a<10)b[0]++;
else if(a<20)b[1]++;
else if(a<30)b[2]++;
else if(a<40)b[3]++;
else if(a<50)b[4]++;
else if(a<60)b[5]++;
else b[6]++;
}

for(i=0;i<7;i++)cout<<b[i]<<endl;
}
return 0;
}

Measured memory_bytes: 1160
#include <iostream>
using namespace std;
int main(){
  int a[32];
  a[0]=1;
  a[1]=1;
  a[2]=1;
  a[3]=2;
  a[4]=1;
  a[5]=2;
  a[6]=1;
  a[7]=5;
  a[8]=2;
  a[9]=2;
  a[10]=1;
  a[11]=5;
  a[12]=1;
  a[13]=2;
  a[14]=1;
  a[15]=14;
  a[16]=1;
  a[17]=5;
  a[18]=1;
  a[19]=5;
  a[20]=2;
  a[21]=2;
  a[22]=1;
  a[23]=15;
  a[24]=2;
  a[25]=2;
  a[26]=5;
  a[27]=4;
  a[28]=1;
  a[29]=4;
  a[30]=1;
  a[31]=51;
  int b;
  cin>>b;
  cout << a[b-1]<<endl;
}

Measured memory_bytes: 256
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let (a, b, c) = {
        let v: Vec<i64> = read_vec();
        (v[0], v[1], v[2])
    };

    let g = gcd(a, gcd(b, c));
    let a = a/g;
    let b = b/g;
    let g = gcd(a, b);
    if g == 1 {
        println!("YES");
    } else {
        println!("NO");
    }
}

fn gcd(a: i64, b: i64) -> i64 {
  if a < 0 {
    gcd(-a, b);
  }

  if b < 0 {
    gcd(a, -b);
  }

  if b > a {
    gcd(b, a);
  }

  if a % b == 0 {
    return b;
  }

  let r:i64 = a % b;

  return gcd(b, r);
}


Measured memory_bytes: 4352
N,C,K = map(int,input().split())
T = sorted([int(input()) for _ in range(N)])

bus = 1
tmp_bus = 1
bus_time = T[0] + K

for t in T[1:]:

    if tmp_bus < C and t <= bus_time:
        tmp_bus += 1
    else:
        bus += 1
        bus_time = t + K
        tmp_bus = 1

print(bus)

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

int main (){
    int count = 0;
    string s;
    cin >> s;
    for (int i = 0; i < 3; i++){
        if (s[i] == '1'){
            count += 1;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256