akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void){

int n;
int a, b, c, d, count;

while(scanf("%d", &n)!=-1){

count=0;

for(a=0; a<=9; a++){
 for(b=0; b<=9; b++){
  for(c=0; c<=9; c++){
   for(d=0; d<=9; d++){
     
   if(a+b+c+d==n)
    count++;

   }
  }
 }
}

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

}

return 0;
}

Measured memory_bytes: 596
#include <cstdio>
const int N=200005,mo=1000000007;
int a[N],b[N],c[N],w[N],cnt[N];

int ksm(int x,int y){
	int i=1;
	for (;y;y>>=1,x=1ll*x*x%mo)
		if (y&1) i=1ll*i*x%mo;
	return i;
}

int main(){
	int n,X,Y;
	scanf("%d%d%d",&n,&X,&Y);
	for (int i=0;i<=n;i++) a[i]=mo;
	for (int i=1;i<=n;i++){
		scanf("%d%d",&c[i],&w[i]);
		if (w[i]<a[c[i]]) a[c[i]]=w[i],b[c[i]]=i;
	}
	int c1=0,c2=0;
	for (int i=1;i<=n;i++)
		if (a[i]<a[c1]) c2=c1,c1=i;
			else if (a[i]<a[c2]) c2=i;
	for (int i=1;i<=n;i++)
		if ((c[i]!=c1 && w[i]+a[c1]<=Y)||(c[i]!=c2 && w[i]+a[c2]<=Y)||
			((i==b[c[i]] || w[i]+a[c[i]]<=X) && a[c[i]]+a[c1]<=Y)) cnt[c[i]]++;
	int ans1=1,ans2=1;
	for (int i=1,j=0;i<=n;i++)
		for (int k=1;k<=cnt[i];k++){
			ans1=1ll*ans1*(++j)%mo;
			ans2=1ll*ans2*k%mo;
		}
	ans1=1ll*ans1*ksm(ans2,mo-2)%mo;
	printf("%d\n",ans1);
}

Measured memory_bytes: 4096
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<string> vstring;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define mod llint(1e9+7)

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(pllint a, pllint b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗をmodで割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, (llint)b / 2);
	tmp *= tmp;
	tmp %= mod;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= mod;
	}
	return tmp;
}

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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll, ll>
#define PP pair<P,P>
using namespace std;

int main(){
    int k,a,b; cin >> k >> a >> b;
    for(int i=a; i<=b; i++){
        if(i%k==0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
return 0;
}


Measured memory_bytes: 3640
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] a = sc.nextLine().split(" ");
		int n = Integer.parseInt(a[0]);
		int x =  Integer.parseInt(a[1]) ;
		int t =  Integer.parseInt(a[2]);
		int answer = 0;
		while (n > 0) {
			n -= x;
			answer += t;
		}
		System.out.println(answer);
	}

}

Measured memory_bytes: 35660
#include <stdio.h>

int main(void){
	int a,b,c,d;

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

	if(a <= c){
		if((c-a) <= d)
		printf("Yes");
		else if((b-a) <= d && (c-b) <= d)
		printf("Yes");
		else
		printf("No");
	}

	else if(a >= c){
		if((a-c) <=d)
			printf("Yes");
		else if((b-c) <= d && (a-b) <= d)
			printf("Yes");
		else
		printf("No");
		
	}

	return 0;
}


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

AB = [tuple(map(int, input().split())) for _ in range(M)]
AB.sort()

l,r = 1,N

ans = 1
for a,b in AB:

    if r <= a:
        ans += 1
        l,r = a,b
    else:
        l = max(l,a)
        r = min(r,b)

print(ans)

Measured memory_bytes: 17084
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <iostream>

using namespace std;
typedef long long ll;

int mo[5]={0,1,0,-1,0};
int ans,n,X1[1000],X2[1000],Y1[1000],Y2[1000],mm[2010][2010]={0};

void calc(int w,int h){
    
    for(int i=0;i<2010;i++)
        for(int j=0;j<2010;j++)
            mm[i][j]=0;
    
    ans=0;
    
    vector<int> x,y;
    map<int,int> mx,my;
    
    scanf("%d",&n);
    
    for(int i=0;i<n;i++){
        scanf("%d%d%d%d",&X1[i],&Y1[i],&X2[i],&Y2[i]);
        
        x.push_back(X1[i]);
        x.push_back(X2[i]);
        y.push_back(Y1[i]);
        y.push_back(Y2[i]);
    }
    
    x.push_back(0);
    x.push_back(w);
    y.push_back(0);
    y.push_back(h);
    
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    x.erase(unique(x.begin(),x.end()),x.end());
    y.erase(unique(y.begin(),y.end()),y.end());
    
    for(int i=0;i<x.size();i++){
        mx[x[i]]=i;
    }
    for(int i=0;i<y.size();i++){
        my[y[i]]=i;
    }
    
    for(int i=0;i<n;i++){
        mm[my[Y1[i]]][mx[X1[i]]]++;
        mm[my[Y1[i]]][mx[X2[i]]]--;
        mm[my[Y2[i]]][mx[X1[i]]]--;
        mm[my[Y2[i]]][mx[X2[i]]]++;
    }
    
    for(int i=0;i<y.size();i++){
        for(int j=0;j<x.size();j++){
            mm[i][j+1]+=mm[i][j];
        }
    }
    
    for(int i=0;i<x.size();i++){
        for(int j=0;j<y.size();j++){
            mm[j+1][i]+=mm[j][i];
        }
    }
    
    
    for(int i=0;i<y.size()-1;i++){
        for(int j=0;j<x.size()-1;j++){
            if(mm[i][j]>0) continue;
            
            queue<pair<int,int> > q;
            q.push(make_pair(i,j));
            mm[i][j]=1;
            ans++;
            
            while(!q.empty()){
                pair<int,int> p = q.front();
                q.pop();
                
                for(int k=0;k<4;k++){
                    if(0<=p.first+mo[k] && p.first+mo[k]<y.size()-1 && 0<=p.second+mo[k+1] && p.second+mo[k+1]<x.size()-1){
                        if(mm[p.first+mo[k]][p.second+mo[k+1]]==0){
                            q.push(make_pair(p.first+mo[k],p.second+mo[k+1]));
                            mm[p.first+mo[k]][p.second+mo[k+1]]=1;
                        }
                    }
                }
            }
        }
    }
    
    printf("%d\n",ans);
    
    return;
}

int main(){
    int w,h;
    
    while(1){
        scanf("%d%d",&w,&h);
        if(w==0) break;
        calc(w,h);
    }
    
    return 0;
}

Measured memory_bytes: 19092
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll N = 2e5 +9;
const ll p = 31;
const ll m = 1e9 + 7;
const ll inf= 1e14;
ll mod = 1e9+7;
ll powm(ll a, ll b) { ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }

int main() {   
     ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    
     ll q = 1;
     // cin>>q;
 
     while(q--){
          bool is_p[N];
          for(int i = 0;i<N;i++){
               is_p[i] = 1;
          }
          for(ll i = 2;i<N;i++){
               if(is_p[i]){
                    for(ll j = 2*i;j<N;j+=i){
                         is_p[j] = 0;
                    }
               }
          }
          ll next = inf;
          ll ans[N];
          for(int i = N-1;i>=0;i--){
               if(is_p[i]){
                    next = i;
               }
               ans[i] = next;
          }
          ll x;cin>>x;cout<<ans[x];
     }
}         

Measured memory_bytes: 2048
-- https://atcoder.jp/contests/abc042/tasks/abc042_a

main :: IO ()
main = do
  xs <- map read . words <$> getLine
  if have 5 2 xs && have 7 1 xs
    then putStrLn "YES"
    else putStrLn "NO"

have :: Int -> Int -> [Int] -> Bool
have x len = (>= len) . length . filter (== True) . map (== x)


Measured memory_bytes: 508
/*  ex3_3
    potter0723sw  */

//方針：numberをaryで何回も割って商が0になるまでの割る回数をカウントする

#include <stdio.h>

int main(void) {
	int number,ary,answer;
	scanf("%d %d", &number, &ary);
	answer = 1;//最後に2桁増えることを考慮して1からスタート
	while(number >= ary){//numberがaryより小さくなったら割るのを終わる
		number = number / ary;
		answer += 1;
	}
	printf("%d\n",answer);
	return 0;
}


Measured memory_bytes: 128
#include <bitset>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int main() {
	string s; int tx, ty;
	cin >> s >> tx >> ty; s += "T";
	vector<int> vx, vy; int dir = 0, cont = 0;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == 'F') ++cont;
		else {
			if (dir == 0) vx.push_back(cont);
			else vy.push_back(cont);
			cont = 0;
			dir ^= 1;
		}
	}
	bitset<16001> bx, by;
	bx[8000 + vx[0]] = 1;
	for (int i = 1; i < vx.size(); ++i) {
		bx = (bx << vx[i]) | (bx >> vx[i]);
	}
	by[8000] = 1;
	for (int i = 0; i < vy.size(); ++i) {
		by = (by << vy[i]) | (by >> vy[i]);
	}
	cout << (bx[8000 + tx] && by[8000 + ty] ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 384
/*   CREATED BY
       STREAM_CIPHER
       16-02-2020
  */
  #include <bits/stdc++.h>
  using namespace std;
  typedef long long  int ll;

   int main()  
   {
        ios_base::sync_with_stdio(false); 
        cin.tie(NULL); 
        
        int a,b,c;
        cin>>a>>b>>c;
        map<int,int>m;
        m[a]++;
        m[b]++;
        m[c]++;
        //cout<<m[a]<<endl;
        if(m[a]==2||m[b]==2||m[c]==2)
          cout<<"Yes\n";
       else
          cout<<"No\n";
   }    

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
const int N=5e5+5;
int n,m,val[N],pos[N],np[N];

namespace utils{
	inline int nxi(FILE *fd=stdin){
		int x=0;
		char c;
		while(((c=fgetc(fd))>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=fgetc(fd));
		while(x=x*10-48+c,(c=fgetc(fd))>='0'&&c<='9');
		return f?-x:x;
	}

	template <class T>
	inline T cabs(const T x){
		return x<0?-x:x;
	}

	template <class T>
	inline void apx(T &x,const T y){
		x<y?x=y:0;
	}

	template <class T>
	inline void apn(T &x,const T y){
		x>y?x=y:0;
	}
}
using namespace utils;

int main(){
	n=nxi(),m=nxi();
	pos[0]=m;
	for(int i=1; i<=n; ++i){
		val[i]=nxi();
		pos[i]=std::min(pos[i-1],cabs(pos[i-1]-val[i]));
	}
	np[n+1]=1;
	for(int i=n; i; --i){
		np[i]=np[i+1]+val[i]*(val[i]<np[i+1]<<1);
	}
	for(int q=nxi(); q; --q){
		const int x=nxi();
		puts(pos[x-1]>=np[x+1]?"YES":"NO");
	}
	return 0;
}


Measured memory_bytes: 7808
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)

using namespace std;

typedef long long LL;

const int INF=0x3f3f3f3f;

int main(){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    bool flag=1;
    while(a>0&&c>0){
        if(flag==1)c-=b;
        else a-=d;
        flag=!flag;
    }
    if(c<=0)puts("Yes");
    else puts("No");
    return 0;
}

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

#define pb push_back
#define ri(x) scanf("%d",&x)
#define rii(x,y) ri(x),ri(y)
#define ms(obj,val) memset(obj,val,sizeof(obj))
#define ms2(obj,val,sz) memset(obj,val,sizeof(obj[0])*sz)
#define FOR(i,f,t) for(int i=f;i<(int)t;i++)
#define FORR(i,f,t) for(int i=f;i>(int)t;i--)

typedef long long ll;
typedef vector<int> vi;

const int MAXN=0;

int main() {
	int x,a,b;
	cin>>x>>a>>b;
	if(a>=b) cout<<"delicious"<<endl;
	else if(b-a<=x) cout<<"safe"<<endl;
	else cout<<"dangerous"<<endl;
}


Measured memory_bytes: 256
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	n <- readInt
	putStrLn $ which "Yes" "No" $ or $ do
		a <- [ 0 .. n ]
		let
			rest = n - a * 4
		guard $ rest >= 0
		return $ rest `mod` 7 == 0 

Measured memory_bytes: 508
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin >> N;
    int a,b,count;
    count = 0;
    for (int i=0;i<N;i++){
        cin >> a >> b;
        if(a==b){
            count++;
            if(count == 3){
                break;
            }
        }else{
            count = 0;
        }
    }
    if(count == 3){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
using namespace std;

using INT = long long;
using UINT = unsigned long long;

unsigned gcd(unsigned a, unsigned b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

const UINT mod = 1000000007;

UINT PowMod(UINT x, UINT y)
{
	if (y == 0)
	{
		return 1;
	}
	else if (y == 1)
	{
		return x % mod;
	}
	else if (y % 2 == 0)
	{
		auto tmp = PowMod(x, y / 2);
		return tmp * tmp % mod;
	}
	else
	{
		auto tmp = PowMod(x, y / 2);
		return (tmp * tmp % mod) * x % mod;
	}
}

UINT getModInv(UINT N)
{
	return PowMod(N, mod - 2);
}

int main()
{
	INT a, b;
	cin >> a >> b;
	if (abs(a - b) % 2 != 0)
	{
		cout << "IMPOSSIBLE" << endl;
	}
	else
	{
		cout << min(a, b) + abs(a - b) / 2 << endl;
	}
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define EPS 0.0000000002
#define MAX 1010001000

typedef struct point{
    double x, y;
}point;

typedef struct line{
    point st, en;
}line;

double norm(point a);
double norm2(point a);
double distans(point a, point b);
point sum_vector(point a, point b);
point diff_vector(point a, point b);
point minus_vector(point a);
double dot(point a, point b);
double prod(point a, point b);

point pv(line a, point p) {
    //直線ab上に点pから垂線を下ろしたときの点h//
    point h;
    double k = dot(diff_vector(a.st, p), diff_vector(a.st, a.en))
                / dot(diff_vector(a.en, a.st), diff_vector(a.en, a.st));
    h.x = k * (a.en.x - a.st.x) + a.st.x;
    h.y = k * (a.en.y - a.st.y) + a.st.y;
    return h;
}

double norm(point a)
{
    //原点からの距離
    return sqrt((a.x * a.x) + (a.y * a.y));
}

double norm2(point a)
{
    //原点からの距離の二乗
    return (a.x * a.x) + (a.y * a.y);
}

double distans(point a, point b)
{
    //二点間の距離
    point tmp = sum_vector(b, minus_vector(a));
    return norm(tmp);
}

point sum_vector(point a, point b)
{
    //ベクトルの和
    a.x += b.x;
    a.y += b.y;
    return a;
}

point diff_vector(point a, point b)
{
    //ベクトルの差
    a.x -= b.x;
    a.y -= b.y;
    return a;
}

point minus_vector(point a)
{
    //逆ベクトル
    a.x *= -1;
    a.y *= -1;
    return a;
}

double dot(point a, point b)
{
    //内積
    return (a.x * b.x) + (a.y * b.y);
}

double prod(point a, point b)
{
    //外積
    return (a.x * b.y) - (b.x * a.y);
}

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

int main(void)
{
    point tmp, p;
    line ab;
    int n, i;

    scanf("%lf%lf%lf%lf%d", &ab.st.x, &ab.st.y, &ab.en.x, &ab.en.y, &n);
    for (i = 0; i < n; i++) {
        scanf("%lf%lf", &p.x, &p.y);
        tmp = pv(ab, p);
        tmp = sum_vector(tmp, diff_vector(tmp, p));
        printf("%.10lf %.10lf\n", tmp.x, tmp.y);
    }

    return 0;

}

Measured memory_bytes: 664
import java.util.*

class Scanner(`in`: java.io.InputStream) {
    private val reader = java.io.BufferedReader(java.io.InputStreamReader(`in`))
    private var tokenizer: StringTokenizer? = null

    fun next(): String {
        if (tokenizer?.hasMoreTokens() != true) {
            tokenizer = StringTokenizer(reader.readLine())
        }
        return tokenizer!!.nextToken()
    }

    fun nextLine(): String {
        return if (tokenizer?.hasMoreTokens() != true) {
            reader.readLine()
        } else tokenizer!!.nextToken("\n")
    }
}

fun dprint(v: Any?, indent: Int = 0) {
    val indentStr = (1..indent).joinToString("") { " " }
    when (v) {
        is Iterable<*> -> {
            System.err.println("$indentStr[")
            v.forEach { dprint(it, indent + 1) }
            System.err.println("$indentStr]")
        }
        is Array<*> -> {
            System.err.println("$indentStr[")
            v.forEach { dprint(it, indent + 1) }
            System.err.println("$indentStr]")
        }
        is IntArray -> System.err.println(indentStr + "[" + v.joinToString(",") + "]")
        is LongArray -> System.err.println(indentStr + "[" + v.joinToString(",") + "]")
        is DoubleArray -> System.err.println(indentStr + "[" + v.joinToString(",") + "]")
        else -> System.err.println(indentStr + v)
    }
}

fun <A : Comparable<A>> min(a: A, b: A) = if (a < b) a else b
fun <A : Comparable<A>> min(vararg a: A) = a.reduce { acc, x -> min(acc, x) }
fun <A : Comparable<A>> max(a: A, b: A) = if (a > b) a else b
fun <A : Comparable<A>> max(vararg a: A) = a.reduce { acc, x -> max(acc, x) }

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

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

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    val sc = Scanner(System.`in`)
//    for (t in 1..sc.next().toInt()) {
    Problem.solve(sc, pw)
//    }
    pw.flush()
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val S = sc.next()
        val T = sc.next()
        for (i in S.indices) {
            if ((S + S).substring(i, i + S.length) == T) {
                pw.println("Yes")
                return
            }
        }
        pw.println("No")
    }
}


Measured memory_bytes: 31264
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
using namespace std;

int main() {
	int n, q, t;
	string name;
	
	queue<pair<string, int>> Q;

	cin >> n >> q;

	for (int i = 0; i < n; i++) {
		cin >> name >> t;
		Q.push(make_pair(name, t));
	}

	pair<string, int> u;
	int elaps = 0, a;

	while (!Q.empty()) {
		u = Q.front(); Q.pop();
		a = min(u.second, q);
		u.second -= a;
		elaps += a;
		if (u.second > 0) {
			Q.push(u);
		}
		else {
			cout << u.first << " " << elaps << endl;
		}
	}
	return 0;
}



Measured memory_bytes: 6400
#include <iostream>
#include <functional>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int a,b,kame,asi;
    cin>>a>>b;
    kame=(b-2*a)/2;
    asi=kame*4+(a-kame)*2;
    if(a==1&&b==1){
        cout<<"Yes"<<endl;
    }else if(b%2!=0||kame<0){
        cout<<"No"<<endl;
    }else if(a-kame<0){
        cout<<"No"<<endl;
    }else if(b==asi){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3572
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();

		long a = 2;
		long b = 1;
		long ans = 1;

		if(n == 1){
			System.out.println(1);
			return;
		}

		for(int i = 1; i < n; i++){
			ans = a+b;
			a = b;
			b = ans;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23764
//#include<iostream>
//#include<algorithm>
//#include<string>
//#include <cmath>
//#include <vector>
#include <bits/stdc++.h>

using namespace std;

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

//vector//
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

typedef pair<int,int> P;  //q(p.first,p.second)

int main (){
    int k; cin >> k;
    for(int i=0; i<k; i++){
        cout << "ACL";
    }
}

Measured memory_bytes: 3632
n=int(input())
s = [""]*n
cnt =[0]*4
for i in range(n):
    s[i] = input()
    if s[i] == "AC":
        cnt[0] +=1
    elif s[i] == 'WA':
        cnt[1]+=1
    elif s[i] == 'TLE':
        cnt[2] +=1
    else:
        cnt[3] += 1
print('AC x',cnt[0])
print('WA x',cnt[1])
print('TLE x',cnt[2])
print('RE x',cnt[3])


Measured memory_bytes: 16164
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let h: usize = itr.next().unwrap().parse().unwrap();
    let w: usize = itr.next().unwrap().parse().unwrap();
    let g: Vec<Vec<char>> = (0..h)
        .map(|_| itr.next().unwrap().chars().collect())
        .collect();

    let mut ans = vec![vec![0; w]; h];
    let dx: Vec<isize> = [0, -1, 0, 1, -1, 1, -1, 1].to_vec();
    let dy: Vec<isize> = [1, 0, -1, 0, -1, 1, 1, -1].to_vec();
    for y in 0..h {
        for x in 0..w {
            for i in 0..8 {
                let nx = x as isize + dx[i];
                let ny = y as isize + dy[i];
                if 0 <= nx
                    && nx < w as isize
                    && 0 <= ny
                    && ny < h as isize
                    && g[ny as usize][nx as usize] == '#'
                {
                    ans[y][x] += 1;
                }
            }
        }
    }

    let mut out = Vec::new();
    for i in 0..h {
        for j in 0..w {
            if g[i][j] == '#' {
                write!(out, "#").ok();
            } else {
                write!(out, "{}", ans[i][j]).ok();
            }
        }
        writeln!(out, "").ok();
    }
    stdout().write_all(&out).unwrap();
}


Measured memory_bytes: 2096
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}

vector<ll> pw2(51,1);vector<ll> pw10(19,1);
ll high_order_bit(ll n){
    ll tmp=1,i=-1;
    while(tmp<=n){
        tmp*=2;
        i++;
    }
    if(n==0) return 0;
    else return i;
}
vector<ll> binary_expansion(ll n){
    vector<ll> B(high_order_bit(n)+1);
    ll tmp=n;
    for(ll i=high_order_bit(n);i>=0;i--){
        B[i]=tmp/pw2[i];
        tmp%=pw2[i];
    }
    return B;
}
vector<ll> divisor(ll x){
    vector<ll> div;
    for(int i=1;i*i<=x;i++){
        if(i*i!=x && x%i==0){
            div.pb(i);
            div.pb(x/i);
        }
        else if(x%i==0) div.pb(i);
    }
    return div;
}
vector<ll> vectorprime(ll x){
    vector<bool> is_prime(x+1);
    vector<ll> prime;
    rep(i,x+1) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    for(int i=2;i<=x;i++){
        if(is_prime[i]){
            prime.pb(i);
        }
        for(int j=i*2;j<=x;j+=i) is_prime[j]=false;
    }
    return prime;
}

int main(){
    {rep1(i,50) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll H,W; cin>>H>>W;
  	if(H==1 || W==1) cout<<1;
  else{
    if(W%2==0){
        cout<<(W/2)*H;
    }
    else{
        cout<<((W+1)/2)*H-H/2;
    }
  }
    
}


Measured memory_bytes: 3620
def solve():
  while True:
    m, n  = int(input()), int(input())
    if not m:
      break
    ices = [[0] + list(map(int,input().split())) + [0] for _ in range(n)]
    ices.insert(0, [0] * (m + 2),)
    ices.append([0] * (m + 2))
    score = [[0] * (m + 2) for _ in range(n + 2)]
    
    for x in range(1, n + 1):
      for y in range(1, m + 1):
        score[x][y] = ices[x - 1][y] + ices[x + 1][y] + ices[x][y - 1] + ices[x][y + 1] 

    def search(x, y, imap, acc):
      imap[x][y] = 0
      acc += 1
      ret = acc
      a = b = c = d = 0
      if imap[x - 1][y]:
        a = search(x - 1, y, imap, acc)
        if ret < a:
          ret = a
      if imap[x + 1][y]:
        b = search(x + 1, y, imap, acc)
        if ret < b:
          ret = b
      if imap[x][y - 1]:
        c = search(x, y - 1, imap, acc)
        if ret < c:
          ret = c
      if imap[x][y + 1]:
        d = search(x, y + 1, imap, acc)
        if ret < d:
          ret = d
      imap[x][y] = 1
      return ret
    
    ans = 0
    for x in range(1, n + 1):
      for y in range(1, m + 1):
        if score[x][y] in [1, 2] and ices[x][y]:
          a = search(x, y, ices, 0)
          if ans < a:
            ans = a
    
    print(ans)

solve()


Measured memory_bytes: 5812
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>
#include <stack>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using Graph = std::vector<std::vector<int> >;
const int INF = 1e17;
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::set<std::string> set;
	rep(i,n) {
		std::string s;
		std::cin >> s;
		set.emplace(s);
	}
	print(set.size());
	return 0;
}


Measured memory_bytes: 19260
#include<bits/stdc++.h> 
using namespace std; 
int main() 
{
	int n; cin>>n;
	int ans = 0;
	for(int i =0; i<n; i++){
		int x; cin>>x;
		if(x != i + 1) ans++;
	}
	if(ans > 2) cout<<"NO"; else cout<<"YES";
    return 0;
} 


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
struct Activ {
    double l, r;
} a[100000];

bool cmp(Activ a, Activ b) {
    return a.r < b.r;
}
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i].l >> a[i].r;
    }
    sort(a, a + n, cmp);
    int ans = 1;
    int before = a[0].r;
    for (int i = 1; i < n; i++) {
        if (before < a[i].l) {
            ans++;
            before = a[i].r;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4844
#include <iostream>

using namespace std;

int m[34][34] = {0};

typedef pair<int, int> Ans;

#define INF 1e9

int H, W, S;
int P;
Ans memo[32][32][32][32];
bool memo2[32][32][32][32];
Ans f(int x1, int y1, int x2, int y2) {
  if (memo2[x1][y1][x2][y2]) return memo[x1][y1][x2][y2];

  int power = m[y2][x2] - m[y1][x2] - m[y2][x1] + m[y1][x1];
  if (P-power <= S) {
    Ans ret = Ans(1, S-(P-power));
    for (int x = x1+1; x < x2; ++x) {
      Ans a1 = f(x1, y1, x, y2);
      Ans a2 = f(x, y1, x2, y2);
      if (a1.first < 0 || a2.first < 0) continue;
      Ans a = Ans(a1.first+a2.first, min(a1.second, a2.second));
      if (a.first > ret.first || (a.first == ret.first && a.second > ret.second)) ret = a;
    }
    for (int y = y1+1; y < y2; ++y) {
      Ans a1 = f(x1, y1, x2, y);
      Ans a2 = f(x1, y, x2, y2);
      if (a1.first < 0 || a2.first < 0) continue;
      Ans a = Ans(a1.first+a2.first, min(a1.second, a2.second));
      if (a.first > ret.first || (a.first == ret.first && a.second > ret.second)) ret = a;
    }
    memo2[x1][y1][x2][y2] = true;
    return memo[x1][y1][x2][y2] = ret;
  }
  else {
    return Ans(-1, 0);
  }
}
int main() {
  while ( cin >> H >> W >> S, H || W || S ) {
    fill(&memo2[0][0][0][0], &memo2[0][0][0][0]+32*32*32*32, false);
    for (int y = 0; y < H; ++y) {
      for (int x = 0; x < W; ++x) {
        cin >> m[y+1][x+1];
      }
    }
    for (int y = 1; y <= H; ++y) {
      for (int x = 1; x < W; ++x) {
        m[y][x+1] += m[y][x];
      }
    }
    for (int x = 1; x <= W; ++x) {
      for (int y = 1; y < H; ++y) {
        m[y+1][x] += m[y][x];
      }
    }
    P = m[H][W] - m[0][W] - m[H][0] + m[0][0];

    Ans ans = f(0, 0, W, H);
    cout << ans.first << " " << ans.second << endl;
  }
}

Measured memory_bytes: 10384
import java.util.Scanner;

public class Main {
    static Scanner in = new Scanner(System.in);

    static void run() {
        int A = in.nextInt(), B = in.nextInt(), H = in.nextInt(), M = in.nextInt();
        double m = 2.0 * Math.PI * M / 60;
        double h = 2.0 * Math.PI * (H * 60 + M) / (60 * 12);
        double a = Math.max(m, h) - Math.min(m, h);
        if (a >= Math.PI) a = 2 * Math.PI - a;
        double d = Math.sqrt(A*A + B*B - 2*A*B*Math.cos(a));
        System.out.println(d);
    }

    public static void main(String[] args) {
        run();
    }
}


Measured memory_bytes: 35992
N, x = map(int, input().split(' '))
Candy = list(map(int, input().split(' ')))
count = 0
if Candy[0] > x:
    count += Candy[0] - x
    Candy[0] = x

for i in range(1, N):
    if Candy[i] + Candy[i-1] > x:
        count += Candy[i] - x + Candy[i-1]
        Candy[i] = x - Candy[i-1]

print(count)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    string N;
    int K;
    cin>>N>>K;
    int n=N.size();
    ll dp[101][2][4]={};
    dp[0][0][0]=1;
    for(int i=0;i<n;i++){
        int a=N[i]-'0';
        for(int j=0;j<=K;j++){
            for(int x=0;x<=9;x++){
                if(x==0){
                    dp[i+1][1][j]+=dp[i][1][j];
                    if(x==a){
                        dp[i+1][0][j]+=dp[i][0][j];
                    }
                    else if(x<a){
                        dp[i+1][1][j]+=dp[i][0][j];
                    }
                }
                else{
                    if(j==K) continue;
                    dp[i+1][1][j+1]+=dp[i][1][j];
                    if(x==a){
                        dp[i+1][0][j+1]+=dp[i][0][j];
                    }
                    else if(x<a){
                        dp[i+1][1][j+1]+=dp[i][0][j];
                    }
                }
            }
        }
    }
    cout<<dp[n][0][K]+dp[n][1][K]<<endl;
}

Measured memory_bytes: 256
from collections import defaultdict
n = int(input())
dic=defaultdict(int)
A = list(map(int, input().split()))
for i in range(n):
    dic[A[i]]+=1

tmp=0
for key in dic.keys():
    tmp+=dic[key]*(dic[key]-1)//2

for k in range(n):
    x=dic[A[k]]
    if x>=2:
        ans=tmp-(x*(x-1)//2)+((x-1)*(x-2)//2)
    else: ans=tmp
    print(ans)

Measured memory_bytes: 26780
#include <stdio.h>
int main(void) {
	int n, a, b, c, d, i, j, k, l;
	int count;
	
	while( scanf("%d",&n) != EOF ) {
		count = 0;
		for( i = 0; i < 10; i++) {
			for( j = 0; j < 10; j++) {
				for( k = 0; k < 10; k++) {
					for( l = 0; l < 10; l++) {
						if( i + j + k + l == n ) {
							count++ ;
						}
					}
				}
			}
		}
		printf("%d\n",count);
	}
	return(0);
}

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

int main()
{
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    A = (A + D - 1) / D;
    C = (C + B - 1) / B;
    cout << (A >= C ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(){
  int N, M;
  cin >> N >> M;
  int64_t sumN = 1;
  int64_t sumM = 1;
  bool can = false;
  for(int i = 1; i <= N; ++i){
    sumN = sumN*i%1000000007;
  }
  for(int i = 1; i <= M; ++i){
    sumM = sumM*i%1000000007;
  }
  int64_t sum = sumN*sumM%1000000007;
  if(abs(N-M) == 1){
    cout << sum << endl;
  }
  else if(N == M){
    sum = sum*2%1000000007;
    cout << sum << endl;
  }
  else cout << 0 << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
def divmod(f, g):
    assert g
    h = 0
    for i in reversed(range(f.bit_length() - g.bit_length() + 1)):
        if f & (1 << (g.bit_length() + i - 1)):
            f ^= g << i
            h ^= 1 << i
    return h, f

def gcd(f, g):
    while g:
        q, r = divmod(f, g)
        f, g = g, r
    return f

import functools
def solve(n, x, a):
    # (g) = (a_1, ..., a_n) is a principal ideal since F_2[x] is a PID
    g = functools.reduce(gcd, a)

    # count h in F_2[x] s.t. h g <= x
    cnt = 0
    h = 0
    for k in reversed(range(x.bit_length() - g.bit_length() + 1)):
        bit = 1 << (g.bit_length() + k - 1)
        if (x & bit):
            cnt += 1 << k
        if (x & bit) != (h & bit):
            h ^= g << k
    cnt += (h <= x)
    return cnt % 998244353


def main():
    n, x = input().split()
    n = int(n)
    x = int(x, 2)
    a = [ int(input(), 2) for _ in range(n) ]
    print(solve(n, x, a))

if __name__ == '__main__':
    main()



Measured memory_bytes: 3572
#include <stdio.h>

int main() {
  while(1) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x == 0 && y == 0) {
      break;
    }
    x < y ? printf("%d %d\n", x, y) : printf("%d %d\n", y, x);
  }
  return 0;
}



Measured memory_bytes: 2568
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)

import heapq
from collections import defaultdict
INF = float("inf")


def solve(N: int, X: int, Y: int):
    if X > Y:
        X, Y = Y, X
    ans = [0]*N
    for i in range(N):
        for j in range(i+1, N):
            d = min(abs(j-i), abs(i-(X-1))+1+abs(j-(Y-1)))
            ans[d] += 1
    print(*ans[1:], sep="\n")
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(N, X, Y)


if __name__ == '__main__':
    main()


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

int main()
{
	multiset<string> s;
	int n,l;
	string str;
	cin>>n>>l;
	for(int i=0;i<n;i++)
	{
		cin>>str;
		s.insert(str);
	}
	multiset<string>::iterator i;
	for(i=s.begin();i!=s.end();i++)
		cout<<*i;
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int h,w,n,a[10010],ans[105][105];
int main()
{
	scanf("%d%d",&h,&w);
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	int x=1,y=1,i=1,t=1;
	while (i<=h*w)
	{
		for (int j=1;j<=a[i];j++)
		{
			ans[x][y]=i;			
			y+=t;
			if (y>w||y<1) x++,t=-t,y+=t; 
		}	
		i++;
	}
	for (int i=1;i<=h;i++)
	{
		for (int j=1;j<=w-1;j++) printf("%d ",ans[i][j]);
		printf("%d\n",ans[i][w]);
	}
	return 0;
}

Measured memory_bytes: 384
W, H, N = map(int, input().split())

x = [0] * N
y = [0] * N
a = [0] * N

for i in range(N):
    x[i], y[i], a[i] = map(int, input().split())

X1 = 0
X2 = 0
Y1 = 0
Y2 = 0

x1, x2, y1, y2 = 0, 0, 0, 0

X = 0
Y = 0

entire = W * H

for i in range(N):
    if a[i]==1 and X1<x[i]:
        x1 = x[i] * H
        X1 = x[i]
    elif a[i]==2 and X2<(W-x[i]):
        x2 = (W-x[i]) * H
        X2 = W - x[i]
    elif a[i]==3 and Y1<y[i]:
        y1 = y[i] * W
        Y1 = y[i]
    elif a[i]==4 and Y2<(H-y[i]):
        y2 = (H-y[i]) * W
        Y2 = H - y[i]

entire = entire - (x1 + x2 + y1 + y2) + ((X1+X2) * (Y1+Y2))

if X1+X2>=W or Y1+Y2>=H:
    print('0')
else:
    print(entire)


Measured memory_bytes: 3064
import * as fs from 'fs';

namespace AtCoder.hitachi2020 {

    export class Program {
        /**
         * in
         * 2 2 1
         * 3 5
         * 3 5
         * 2 2 2
         * out
         * 6
         */
        static main(inp: string): void {

            // a,bの最安値
            // クーポンを使ったときの値
            const [a, b, m]: number[] = inp.split('\n')[0].split(' ').map(Number);
            const aList: number[] = inp.split('\n')[1].split(' ').map(Number);
            const bList: number[] = inp.split('\n')[2].split(' ').map(Number);

            let ans1: number = 0;
            // ans1 = aList.sort()[0];
            // ans1 += bList.sort()[0];
            ans1 = Math.min(...aList)
            ans1 += Math.min(...bList)
            // ans1 = aList.reduce((a, b) => Math.min(a, b));
            // ans1 += bList.reduce((a, b) => Math.min(a, b));

            // クーポン
            const ww: string[] = inp.split('\n');
            for (let i: number = 0; i < m; i++) {
                const [x, y, c]: number[] = ww[i + 3].split(' ').map(Number);

                let wk: number = aList[x - 1] + bList[y - 1] - c;
                if (ans1 > wk) {
                    ans1 = wk;
                }
            }

            console.log(ans1);

        }
    }
}

AtCoder.hitachi2020.Program.main(fs.readFileSync('/dev/stdin', 'utf8').trim());


Measured memory_bytes: 60108
n = gets.to_i
n.times{|i|
    lines = []
    9.times{lines << " " + gets.chomp}
    for y in 0..8
        temp = Array.new(10, 0)
        for x in 0..8
            temp[lines[y][x * 2 + 1].to_i] += 1
        end
        for x in 0..8
            lines[y][x * 2] = '*' if temp[lines[y][x * 2 + 1].to_i] > 1
        end
    end
    for x in 0..8
        temp = Array.new(10, 0)
        for y in 0..8
            temp[lines[y][x * 2 + 1].to_i] += 1
        end
        for y in 0..8
            lines[y][x * 2] = '*' if temp[lines[y][x * 2 + 1].to_i] > 1
        end
    end
    for a in 0..2
        for b in 0..2
            temp = Array.new(10, 0)
            for c in 0..2
                for d in 0..2
                    temp[lines[a * 3 + c][b * 6 + d * 2 + 1].to_i] += 1
                end
            end
            for c in 0..2
                for d in 0..2
                    lines[a * 3 + c][b * 6 + d * 2] = '*' if temp[lines[a * 3 + c][b * 6 + d * 2 + 1].to_i] > 1
                end
            end
        end
    end
    lines.each{|line| puts line}
    puts if i != n - 1
}


Measured memory_bytes: 6872
#include<bits/stdc++.h>
 
using namespace std;
#define pb push_back
#define f(ii,aa,nn) for(long long int ii=(aa);(ii)<=(nn);(ii)++)
#define endl '\n'
#define MOD 1073741824
#define getiarr(arr_,nn) for(long long int ii=0;(ii)<(nn);(ii)++)cin>>arr_[ii];

typedef vector<int> vi;
typedef long long int ll;

int main(){

		int n;cin>>n;
		if(n<30)
		cout<<"No";
		else
		cout<<"Yes";
		return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
#define mod 1000000007
ll gcd (ll x, ll y){
	ll r = x % y ;
	if(r == 0) return y ;
	return gcd(y, r) ;
}
bool isprime(ll x){
	ll s = sqrt((double) x) ;
	for(ll i = 2; i <= s ; i++){
		if(x % i == 0) return false ; 
	}
	return true ;
}
int main (){
	ll a, b ;
	cin >> a >> b ;
	ll k = gcd(a, b) ;
	ll s = sqrt((double)k) ;
	vector<ll> y ;
	for(ll i = 1; i <= s; i++){
		if(k % i == 0){
			y.push_back(i) ;
			if(i != k/i){
				y.push_back(k/i) ;
			}
		}
	}
	sort(y.begin(), y.end()) ;
	ll num = y.size() ;
	ll ans = 0 ;
	rep(i, num){
		if(isprime(y[i])) ans++ ;
	}
	cout << ans << endl ;
}

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

int main(){
    int n,q;
	cin >> n >> q;
    atcoder::dsu uf(n);
    int t,u,v;
    for(int i=0;i<q; i++){
        cin >> t >> u >> v;
        if(t)cout << uf.same(u,v) << endl;
        else uf.merge(u, v);
    }
}

Measured memory_bytes: 4028
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<set>
using std::cin;using std::cerr;
using std::max;using std::min;
#define N 105
#define P 19990213
#define ll long long
#define ull unsigned long long
#define db double
#define dbg1(x) cerr<<#x<<"="<<x<<" "
#define dbg2(x) cerr<<#x<<"="<<x<<"\n"
int n,mark[N];ll ans;
char s[N];
std::map<ull,int>mp[20];
void work1(int step,int cnt)
{
	if(step>n)
	{
		ull ha=0;
		for(int i=1;i<=n;i++) if(mark[i]) ha=ha*P+s[i];
		for(int i=1;i<=n;i++) if(!mark[i]) ha=ha*P+s[i];
		mp[cnt][ha]++;
		return;
	}
	mark[step]=1,work1(step+1,cnt+1);
	mark[step]=0,work1(step+1,cnt);
}
void work2(int step,int cnt)
{
	if(step==n)
	{
		ull ha=0;
		for(int i=n<<1;i>n;i--) if(mark[i]) ha=ha*P+s[i];
		for(int i=n<<1;i>n;i--) if(!mark[i]) ha=ha*P+s[i];
		ans+=mp[cnt][ha];
		return;
	}
	mark[step]=1,work2(step-1,cnt+1);
	mark[step]=0,work2(step-1,cnt);
}
int main()
{
	scanf("%d%s",&n,s+1);
	work1(1,0);
	work2(n<<1,0);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 33024
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    char c;
    cin >> c;
    c++;
    cout << c << endl;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
const int N=1e5+2;
int n,m,cnt1,hx[N];

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

int main(){
#ifndef ONLINE_JUDGE
//	freopen("d.in","r",stdin);
#endif
	n=nxi(),m=nxi();
	for(int i=1;i<=m;++i){
		hx[i]=nxi();
		cnt1+=hx[i]&1;
	}
	if(cnt1>2){
		puts("Impossible");
		return 0;
	}
	for(int i=2;i<m;++i){
		if(hx[i]&1){
			if(hx[1]&1) std::swap(hx[i],hx[m]);
			else std::swap(hx[1],hx[i]);
		}
	}
	for(int i=1;i<=m;++i){
		printf("%d ",hx[i]);
	}
	puts("");
	if(m==1&&n!=1){
		printf("2\n%d 1\n",n-1);
		return 0;
	}
	++hx[1];
	if(!--hx[m]) --m;
	printf("%d\n",m);
	for(int i=1;i<=m;++i){
		printf("%d ",hx[i]);
	}
	puts("");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;  
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define Rep(i, a, b) for(ll i = a; i <= b; i++)
#define repr(i, a, b) for(ll i = b-1; i >= a; i--)
// #define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
// #define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
// const ll INF = 1LL << 60;
const ll INF = 100000000000;
#define pp pair<ll, pair<ll, ll>> 
// #define fi first
// #define se second
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
 
/*--------------------------------------------------------------------------------
 
--------------------------------------------------------------------------------*/
ll H, W;
vector<vector<bool>> seen;
Vs s;
ll ans = 0;

void bfs(ll h, ll w){
    queue<pair<ll, ll>> qu;
    qu.push({h, w});
    ll cnt_b = 0, cnt_w = 0;
    while(!qu.empty()){
        ll uh = qu.front().first, uw = qu.front().second;
        qu.pop();
        rep(i, 0, 4){
            ll vh = uh + dy[i], vw = uw + dx[i];
            if(vh < 0 || vh >= H || vw < 0 || vw >= W) continue;
            if(seen[vh][vw]) continue;
            if(s[uh][uw]==s[vh][vw]) continue;
            qu.push({vh, vw});
            seen[vh][vw] = true;
            if(s[vh][vw] == '.') cnt_w++;
            else cnt_b++;
        }
    }
    // cout << cnt_b << " " << cnt_w << endl;
    ans += cnt_b * cnt_w;
}

int main() {
    cin >> H >> W;
    seen = vector<vector<bool>>(H, vector<bool>(W));
    s.resize(H);
    rep(i, 0, H) cin >> s[i];
    rep(i, 0, H){
        rep(j, 0, W){
            if(seen[i][j]) continue;
            bfs(i, j);
        }
    }
    co(ans);

    return 0;
}

Measured memory_bytes: 3836
#include<bits/stdc++.h>
#define lowbit(x) ((x)&(-(x)))
#define ll long long
#define INF 0x3f3f3f3f
#define N 100000
#define CLR(a) memset(a, 0, sizeof(a))
using namespace std;
int a,b;
int main() {
	cin>>a>>b;
	if((a+b)%2)
		cout<<"IMPOSSIBLE"<<endl;
	else
		cout<<(a+b)/2<<endl;
	return 0;
}


Measured memory_bytes: 256