akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
class Program
{
    static void Main()
    {
        //入力
        //int n = 100;
        /*
        long n = long.Parse(Console.ReadLine());
        long[] input = new long[5];
        for(int a = 0; a < 5; a++)
        {
            input[a]=long.Parse(Console.ReadLine());
        }
        */
        int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        Console.WriteLine(input[0] % 3 == 0 || input[1] % 3 == 0 ||(input.Sum())%3==0 ? "Possible" : "Impossible");


        /*
        //処理速度計測
        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //解法
 
        //処理速度表示
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms");
        */
        Console.ReadLine();

    }
}

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

using namespace std;
#define REPP(i,a,b,c) for(int i=a; i<=b; i+=c)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,c) for(int i=a; i>=b; i-=c)
#define REV(i,a,b) REVV(i,a,b,1)
#define FOR(i,a) REP(i,0,(int)a-1)
#define FORD(i,a) REV(i,(int)a-1,0)
#define PB push_back
#define POB pop_back
#define MP make_pair
#define FI first
#define SE second
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef vector < int > vi;
typedef vector < pii > vii;
typedef vector < ll > vl;

const double EPS = 1e-9;
const double PI = acos(-1);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

ll addMod(ll a, ll b){
	return (a+b) % MOD;
}

ll mulMod(ll a, ll b){
	return (a*b) % MOD;
}

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


string str;
int cnt[30];

bool solve(){
	FOR(i,str.length()) cnt[str[i]-'a']++;
	FOR(i,26) if(cnt[i] % 2 == 1) return false;
	return true;
}

int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> str;
	if(solve()) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define reps(i,n) for (int i=1;i<=(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rreps(i,n) for (int i=(n);i>0;i--)
#define all(v) (v).begin(),(v).end()
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>
template<class T> inline bool chmin(T &a, T b) {if (a>b) {a = b; return 1;} return 0;};
template<class T> inline bool chmax(T &a, T b) {if (a<b) {a = b; return 1;} return 0;};
typedef long long int ll;
const long long INF = 1LL << 60;

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

  vector<ll> dp(100110, INF);
  dp[0] = 0;
  rep(i,N) reps(to,K) chmin(dp[i+to], dp[i]+abs(h[i+to]-h[i]));
  
  cout << dp[N-1] << endl;

 

  // cout << fixed << setprecision(10);
  
  return 0;
}


Measured memory_bytes: 4576
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string.h>
#include <bitset>
#include <queue>
#include <map>
#include <string>
#include <stack>
#include <utility>
#include <queue>
#include <cmath>
#define mp make_pair
#define pii pair<long long int,long long int> 
#define ff first
#define pb push_back
#define ss second
#define ll long long 
#define ull unsigned long long
#define vi vector<long long int>
#define vii vector<pii>
#define vvi vector <vi>
#define rep(x,a,b,c) for(int x=a;x<=b;x+=c)
#define repp(x,a,b) rep(x,a,b,1)
#define rev(x,a,b,c) for(int x=a;x>=b;x-=c)
#define revv(x,a,b) rev(x,a,b,1)
#define OO (int)2e9
#define INF (ll)1e18
#define EPS (double)1e-5
 
using namespace std;

double x[5],y[5],xx,yy,a,b,c,d,e,f,s,s1,s2,s3,aa,a1,a2,a3;

int main()
{
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[1],&y[1],&x[2],&y[2],&x[3],&y[3],&xx,&yy)!=EOF)
	{
		a=sqrt((x[2]-x[1])*(x[2]-x[1])+(y[2]-y[1])*(y[2]-y[1]));
		b=sqrt((x[2]-x[3])*(x[2]-x[3])+(y[2]-y[3])*(y[2]-y[3]));
		c=sqrt((x[3]-x[1])*(x[3]-x[1])+(y[3]-y[1])*(y[3]-y[1]));
		d=sqrt((xx-x[1])*(xx-x[1])+(yy-y[1])*(yy-y[1]));
		e=sqrt((xx-x[2])*(xx-x[2])+(yy-y[2])*(yy-y[2]));
		f=sqrt((xx-x[3])*(xx-x[3])+(yy-y[3])*(yy-y[3]));
		s=(a+b+c)/(double)2;
		s1=(a+d+e)/(double)2;
		s2=(b+e+f)/(double)2;
		s3=(c+d+f)/(double)2;
		aa=sqrt(s*(s-a)*(s-b)*(s-c));
		a1=sqrt(s1*(s1-a)*(s1-d)*(s1-e));
		a2=sqrt(s2*(s2-b)*(s2-e)*(s2-f));
		a3=sqrt(s3*(s3-c)*(s3-d)*(s3-f));
		if(abs(aa-a1-a2-a3)<=0.0001)
		printf("YES\n");
		else
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 3180
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
bool AC[100005];
int b[100005];
int cnt1, cnt2;
int main() {
	int n, m;
	cin >> n >> m;
	if(m == 0) {
		cout << "0 0\n";
		return 0;
	}
	for(int i=0; i<m; i++) {
		int num;
		string s;
		cin >> num >> s;
		if(AC[num]) {
			continue;
		}
		else {
			if(s[0] == 'W') {
				b[num]++;
			}
			else {
				cnt2++;
				AC[num] = true;
			}
		}
	}
	for(int i=1; i<=n; i++) {
		if(AC[i]) cnt1 += b[i];
	}
	cout << cnt2 << " " << cnt1 << endl;
	return 0;
} 

Measured memory_bytes: 768
n=input()
m=n.split(" ")
a=[]
k=0
for i in m:
    if i!="+" and i!="-" and i!="*" :
        z=int(i)
        a.append(z)
    
    else :
        if i=="+":
                k=a.pop()+a.pop()
                a.append(k)
        elif i=="-":
                k=a.pop(-2)-a.pop()
                a.append(k)
        else:
            k=a.pop()*a.pop()
            a.append(k)
print(a.pop())


Measured memory_bytes: 5592
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc= new Scanner(System.in);
		int h1=-1,h2=-1,h3=-1;
		for(int i=0;i<10;i++){
			int h=sc.nextInt();
			if(h>h1){
				h3=h2;
				h2=h1;
				h1=h;
			}else if(h>h2){
				h3=h2;
				h2=h;
			}else if(h>h3){
				h3=h;
			}
		}
		System.out.println(h1);
		System.out.println(h2);
		System.out.println(h3);
	}
}

Measured memory_bytes: 26124
#include <atcoder/fenwicktree>
using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr lint B1 = 1532834020;
constexpr lint M1 = 2147482409;
constexpr lint B2 = 1388622299;
constexpr lint M2 = 2147478017;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
template<class T>void chmax(T &a, const T &b) { if (a<b) a=b; }
template<class T>void chmin(T &a, const T &b) { if (b<a) a=b; }
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N, Q;
  cin >> N >> Q;
  fenwick_tree<lint> fw(N);
  REP(i, N) {
    lint a;
    cin >> a;
    fw.add(i, a);
  }
  REP(q, Q) {
    int t, a, b;
    cin >> t >> a >> b;
    if(t == 0) fw.add(a, b);
    else cout << fw.sum(a, b) << "\n";
  }
}

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

#define fi first
#define se second

vector<pair<int,int> >adj[10010];
priority_queue<pair<int,int> > pq;
int nodes[10010];

int main(){
	memset(nodes,-1,sizeof(nodes));
	int n,node,k,v,c;
	cin>>n;
	for (int i=0; i<n; ++i) {
		cin>>node>>k;
		for (int j=0; j<k; ++j) {
			cin>>v>>c;
			adj[node].push_back(make_pair(v,c));
		}
	}
	pq.push(make_pair(0,0));
	while(!pq.empty()){
		pair<int,int> cur=pq.top();
		pq.pop();
		if(nodes[cur.se]!=-1){//kalo udh didatengin
			continue;
		}
		else nodes[cur.se]=-cur.fi;
		for(int i=0;i<adj[cur.se].size();i++){
			pq.push(make_pair(-adj[cur.se][i].se+cur.fi,adj[cur.se][i].fi));
		}
	}
	for (int i=0; i<n; ++i) {
		cout<<i<<" "<<nodes[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 12028
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<string,string> Pstring;
typedef pair<double,double> Pdouble;


#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define Precision13 cout << fixed << setprecision(13)
const double PI=3.14159265358979323846;
const int MAX = 510000;
const int MOD = 1000000007;
const int INF = 1<<29;
using Graph = vector<vector<int>>;

int main() {

  ll a,b,n;
  cin >> a>>b>>n;
  double A,B,N,x,y;
  ll ans;
  if(n<b-1){
    A = a;
    B = b;
    N = n;
    x=N/B;
    x = a*x;
    y=N/B;
    ans=(ll)x-a*(ll)y;
  }else{
    A = a;
    B = b;
    N = b-1;
    x=N/B;
    x = a*x;
    y=N/B;
    ans=(ll)x-a*(ll)y;
  }
  cout << ans << endl;

}
  
  


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

using namespace std;

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;i++)
#define FORVEC(i, v) for(int i = 0;i < v.size();i++)

#define INF 1000000000
#define pb(a) push_back(a)
#define llong long long
#define vi vector<int>
#define P pair<int,int>
#define all(vec) (vec.begin()),(vec.end())

int main(){
	int n,q;
	set<int> S;
	int ans=0,buf;

	cin>>n;
	REP(i,n){
		cin>>buf;
		S.insert(buf);
	}
	cin>>q;
	REP(i,q){
		cin>>buf;
		if(S.count(buf)){
			ans++;
		}
	}
	cout<<ans<<"\n";
	return 0;
}

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

int main(void) {
    int N,M,D;cin>>N>>M>>D;
    char kizai[N][M];
    for (int i = 0; i < N; i++) {
        string s;cin>>s;
        for (int j = 0; j < M; j++) {
            kizai[i][j] = s[j];
        }
    }
    int result = 0;
    // 南北
    for (int j = 0; j < M; j++) {
        for (int i = 0; i < N - D + 1; i++) {
            bool flg = true;
            for (int k = i; k <= i+D-1; k++) {
                if (kizai[k][j] == '#') flg = false;
            }
            if (flg) result++;
        }
    }

    // 東西
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M - D + 1; j++) {
            bool flg = true;
            for (int k = j; k <= j + D - 1; k++) {
                if (kizai[i][k] == '#') flg = false;
            }
            if (flg) result++;
        }
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 3184
def countyakusu(n):
	yakusuu=[]
	for i in range(1,int(n**0.5)+1): 
		if n%i==0:
			yakusuu.append(i)
			if i!=n//i:
				yakusuu.append(n//i)
	return yakusuu
x = int(input())
for i in range(x,10**6):
	cnt = countyakusu(i)
	if len(cnt) == 2:
		print(i)
		break

Measured memory_bytes: 2940
/* Header {{{ */
#include <bits/stdc++.h>
using namespace std;

typedef long long readtype;
typedef long long var;
typedef long double let;

readtype read() {
  readtype a = 0, c = getchar(), s = 0;
  while (!isdigit(c)) s |= c == '-', c = getchar();
  while (isdigit(c)) a = a * 10 + c - 48, c = getchar();
  return s ? -a : a;
}
/* }}} */

const int N = 304;
const int MOD = 1e9 + 7;

inline void add(int &a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

int a[N << 1];
bool v[N << 1], mark[N << 1];
int f[N << 1][N][N];

int main() {
  int n = read() * 2;
  for (int i = 1; i <= n; ++i) a[i] = read();
  for (int i = 1; i <= n; ++i) {
    if (a[i] != -1) v[a[i]] = true;
  }

  int have = 0;
  for (int i = 1; i <= n; i += 2) {
    if (a[i] == -1 && a[i + 1] == -1) ++have;
    if (a[i] != -1 && a[i + 1] != -1)
      mark[a[i]] = mark[a[i + 1]] = true;
  }

  var res = 1;
  for (int i = 1; i <= have; ++i) 
    (res *= i) %= MOD;

  f[n + 1][0][0] = 1;
  for (int i = n; i >= 1; --i) {
    if (mark[i]) {
      for (int j = 0; j <= n; ++j)
        for (int k = 0; k <= n; ++k) f[i][j][k] = f[i + 1][j][k];
      continue;
    }

    for (int j = 0; j <= n / 2; ++j) {
      for (int k = 0; k <= n / 2; ++k) {
        if (!f[i + 1][j][k]) continue;
        if (v[i]) {
          if (j) add(f[i][j - 1][k], f[i + 1][j][k]);
          add(f[i][j][k + 1], f[i + 1][j][k]);
        } else {
          if (j) add(f[i][j - 1][k], f[i + 1][j][k]);
          if (k) add(f[i][j][k - 1], (1ll * k * f[i + 1][j][k]) % MOD);
          add(f[i][j + 1][k], f[i + 1][j][k]);
        }
      }
    }
  }

  printf("%lld\n", (res * f[1][0][0]) % MOD);
  return 0;
}


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

using namespace std;

typedef long long ll;

int main(){
	ios::sync_with_stdio(false);
	ll x;
	cin >> x;
	ll ans;
	if(x <= 6)
		ans = 1;
	else{
		ll mod = x%11;
		ans = x/11*2;
		if(mod > 6)
			ans += 2;
		else if(mod)
			ans++;
	}

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


Measured memory_bytes: 256
#include <iostream>
#include <cstring>

using namespace std;
class Dice1{
    private:
        int label[7] = {1,2,3,4,5,6,-1};
        int position[6] = {1,2,3,4,5,6}; //top, S, E,  W,N, bottom
        int north = 5;
        void setroll(int r[5], int a, int b, int c, int d, int e){
            r[0]=a;r[1]=b;r[2]=c;r[3]=d;
            r[4]=e;
        }
    public:

        Dice1(){
            SetLabel();
        
        }

        void ShowPos(){
            
            for(int i=0; i < 7; i++)
                cout << label[i]<<",";
            cout << endl;
        }

        void SetLabel(void){
            for(int i=0; i < 6; i++)
                cin >> label[i];
        }

        int top(void){
            return label[0];
        }

        void roll(char s){
            int rollset[6] = {0,1,5,4, 6},i;
            if(s=='S'){
            /*1 2 6 5 -> 5 1 2 6*/
             
            }
            else if(s=='E'){
                setroll(rollset, 0, 2, 5, 3, 6);
            }
            else if(s=='N'){
                setroll(rollset, 0,4,5,1,6);
             
            }
            else {
                setroll(rollset, 3,5,2,0, 6);
            }
    //cout << label[0] << endl;
            for(i=4; i > 0; i--){
                //cout <<"rollset[" << i << "]=" << rollset[i]  << " " << label[rollset[i]]<< endl;
                label[rollset[i]] = label[rollset[i -1]];
            }
        
            label[rollset[0]] = label[rollset[4]];
        }
};

int main(int argc, char const *argv[])
{
    Dice1 * d = new Dice1;
    
    string order;
    cin >> order;
    for(int i = 0; i < (int)order.size(); ++i){
        d->roll(order[i]);
    }
    cout << d->top() << endl;
   // d->ShowPos();
    return 0;
}



Measured memory_bytes: 3224
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;

ll gcd(ll x, ll y){
    if ( x % y == 0 ) return y;
    else if ( y % x == 0 ) return x;
    else
        return x > y ? gcd( x % y, y ): gcd( x, y % x );
}

int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a, b, c, d, e;
    cin >> a >> b >> c >> d;
    
    e = c * d / gcd( c, d );
    
    cout << (b - a + 1) - ( b / c - (a - 1) / c + b / d - (a - 1) / d - ( b / e - ( a - 1 ) / e ) ) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    long int L,R;
    int i,j;
    long int tmp;
    int min = 2019*2019;

    scanf("%ld %ld",&L,&R);

    if(R-L >= 2019){
        printf("0\n");
        return 0;
    }

    L = L%2019;
    R = R%2019;
    if(L > R) {
        tmp = L;
        L = R;
        R = tmp;
    }
    //printf("%ld %ld\n",L,R);
    //LとRは2019以下で、Lの方がRよりも小さい数

    if(L+1 >= R){
        min = L*R;
        min = min%2019;
    } else {
        for(i=L; i<R-1; i++){
            for(j=i+1; j<=R; j++){
                tmp = i*j;
                tmp = tmp%2019;
                if(min > tmp){
                    min = tmp;
                }
            }
        }
    }



    printf("%d\n",min);
    
    return 0;
}

Measured memory_bytes: 128
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
# endregion
A, B, C = ri_()
for i in range(101):
    if A * i % B == C:
        print('YES')
        exit()
print('NO')

Measured memory_bytes: 63096
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <iomanip>
#include <deque>
#include <list>
#include <cassert>
#include <complex>
#include <bitset>
#include <deque>


using namespace std;
typedef long long ll;
#define int ll
typedef long double ld;
typedef vector<int> vi;
typedef vector<ld> vld;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
#define mmin(a, b) a = min(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define SZ(a) ((int)(a).size())
#define watch(x) cout << (#x) << " = " << (x) << endl;


const int N = 1 << 19, K = 101, oo = 1e9 + 10, A = 201, B = 400, psz = 20;
const ll M = 1e9 + 9, x = 100019;
const ld pi = atan2(1, 0) * 2;


int gcd(int a, int b)
{
	if (!b)
		return a;
	else
		return gcd(b, a % b);
}


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

	int n, d;
	cin >> n >> d;
	vi vl(n);

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

	sort(ALL(vl));

	if (d > vl[SZ(vl) - 1])
	{
		cout << "IMPOSSIBLE\n";
		return 0;
	}

	vl.erase(unique(ALL(vl)), vl.end());

	int div = vl[0];
	set<int> ans;

	int label = 1;
	while (label)
	{
		label = 0;
		for (int i = 0; i < n; ++i)
		{
			if (vl[i] > div && vl[i] % div)
			{
				vl[i] %= div;
				label = 1;
			}

			div = min(div, vl[i]);
		}
	}
	for (int i = 0; i < n; ++i)
		if (abs(d - vl[i]) % div == 0)
		{
			cout << "POSSIBLE\n";
			return 0;
		}

	cout << "IMPOSSIBLE\n";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
//#define int long long
typedef pair<int,int> ii;
typedef tuple<int,int,int> iii;
#define ll long long
#define iiMPQ priority_queue<ii,vector<ii>,greater<ii> >
#define MPQ priority_queue<int,vector<int>,greater<int> >
#define PQ priority_queue<int>
#define iiPQ priority_queue<ii>
#define US unordered_set<int>
#define UMS unordered_multiset<int>
#define UM unordered_map<int>
#define iiUS unordered_set<ii>
#define ST stack<int>
#define MS multiset<int>
#define scan1(n) cin>>n
#define scan2(a,b) cin>>a>>b
#define scan3(a,b,c) cin>>a>>b>>c
#define print(n) cout<<n
#define println(n) cout<<n<<"\n"
#define vi vector<int>
#define vii vector<ii>
#define viii vector<iii>
#define first fi
#define second se
#define REP(i,n) for(int i=0;i<n;++i)
#define SET(arr,k) memset(arr,k,sizeof arr)
#define speed ios::sync_with_stdio(0); cin.tie(0);
#define mp make_pair
#define pb push_back
#define Q queue
#define V vector

void m1(){
  int a; scan1(a);
  print(a+a*a+a*a*a);
}
/* 
void m2(){
  int t; scan1(t);
  while(t--) m1();
}
*/
 
int main(){
  speed;
  //freopen("in.txt","r",stdin);
  m1();
  //m2();
}

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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fill(a,v) memset(a,v,sizeof(a))
#define d1(a) cout << a << "\n"
#define d2(a,b) cout << a << " " << b << "\n"
#define d3(a,b,c) cout << a << " " << b << " " << c << "\n"
#define d4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << "\n"
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

int32_t main(){
	fast;
	string s;
	cin >> s;
	if(s == "AAA" || s == "BBB")
		cout << "No";
	else
		cout << "Yes";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#define N 100010
using namespace std;
struct Edge
{
    int v, next;
}edge[2 * N];
int k, head[N], siz[N], fa[N], dep[N];
void add_edge(int u, int v)
{
    edge[++k].v = v;
    edge[k].next = head[u];
    head[u] = k;
}
void dfs(int u, int pre, int deep)
{
    siz[u] = 1;
    fa[u] = pre;
    dep[u] = deep;
    for(int kk = head[u]; ~kk; kk = edge[kk].next)
    {
        int v = edge[kk].v;
        if(v== pre) continue;
        dfs(v, u, deep + 1);
        siz[u] += siz[v];
    }
}
int main()
{
    int n, i, u, v;
    scanf("%d", &n);
    k = -1;
    memset(head, -1, sizeof(head));
    for(i = 1; i < n; ++i)
    {
        scanf("%d%d", &u, &v);
        add_edge(u, v);
        add_edge(v, u);
    }
    dfs(1, -1, 1);
    int num = dep[n];
    num = num - (num + 1) / 2;
    num--;
    int now = n;
    while(num--) now = fa[now];
    int black = n - siz[now], white = siz[now];
    if(black > white)
        puts("Fennec");
    else
        puts("Snuke");
    return 0;
}


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

#define FOR(i, a, b) for (int i = (a); i < static_cast<int>(b); i++)
#define FORR(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) FOR (i, 0, n)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
template <typename T>
void print(const vector<vector<T>> matrix);
template <typename T>
void print(const vector<T> vec);
template <typename Arg>
void print(const Arg arg);
template <typename Head, typename... Args>
void print(const Head head, const Args... args);
template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;

vector<int> lst;

bool is_prime(int n) {
    repall (i, lst)
        if (i == n) return true;
    return false;
}

bool safe(vector<int> vec) {
    do {
        if (is_prime(vec[0] + vec[1] + vec[2] + vec[3] + vec[4])) return false;
    } while (next_permutation(all(vec)));
    return true;
}

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

    int N = 100000;

    int n;
    cin >> n;

    vector<bool> prime(N, true);
    prime[0] = false, prime[1] = false;
    for (int i = 2; i <= N; i++) {
        if (prime[i]) {
            lst.pb(i);
            for (int j = 2 * i; j <= N; j += i) prime[j] = false;
        }
    }

    vector<int> ans;
    repall (i, lst) {
        if (i % 5 == 1) ans.pb(i);
        if (ans.size() == n) break;
    }

    print(ans);

    return 0;
}

//---------------------------------------------
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    repall (i, vec)
        cout << i << ' ';
    cout << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}


Measured memory_bytes: 384
s = input()
t = input()

ans = 10000

for i in range(len(s) - len(t) + 1):
    score = 0
    U = s[i:i + len(t)]
    for j in range(len(t)):
        if U[j] != t[j]:
            score += 1
    ans = min(ans, score)

print(ans)

Measured memory_bytes: 9004
#include <bits/stdc++.h>
#include <cstdint>
#define pi 3.14159
#define ll long long
// #define int ll
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
ll n;
ll a[200005];
unordered_map<ll,ll> m;
unordered_map<ll,set<ll>> m1;
ll ans;
// void find(ll n){
//   set<ll> v;
//   if(m1.find(n)!=m1.end()) v=m1[n];
//   else{
//     for(ll i=2;i<=sqrt(n)+1;i++){
//       if(n%i==0) v.insert(i);
//       if(n%i==0 && n%(n/i)==0) v.insert(n/i);
//     }
//     v.insert(1);
//     v.insert(n);
//     m1[n]=v;
//   }
//
//   ll flag=1;
//   for(auto i:v){
//     if(m.find(i)!=m.end()){
//       if(i!=n){
//         flag=0;
//       }
//       else{
//         if(m[i]>1) flag=0;
//       }
//     }
//   }
//   if(flag) {ans++;}
// }
ll y[1000011];
void  solve(){
  cin>>n;
  ans=0;
  rep(i,0,n) cin>>a[i],m[a[i]]++;
  if(m.find(1)!=m.end()){
    if(m[1]==1) {cout<<1<<endl;return;}
    else {cout<<0<<endl;return;}
  }

  for(auto i:m){
    ll num=i.f,tine=i.s;
    for(ll j=num;j<=1000011;j+=num){
      y[j]+=tine;
    }
  }
  for(auto i:m){
    if(y[i.f]==1) ans++;
  }
  // rep( i,0,n) find(a[i]);
  cout<<ans<<endl;
}
int main(){
    optimizeIO();
    solve();
}


Measured memory_bytes: 20296
A, B, C, D = map(int,input().split())

i = 1
while i > 0:
  C -= B
  A -= D
  if (C <= 0 and A > 0) or (C <= 0 and A <= 0):
  	print('Yes')
  	break
  elif A <= 0:
  	print('No')
  	break

Measured memory_bytes: 9108
import java.util.*;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<String, Long> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String s = sc.next();
            if (map.containsKey(s)) {
                long count = map.get(s);
                map.put(s, ++count);
            } else {
              map.put(s, (long) 1);
            }
        }

        long max = map.entrySet().stream().map(Map.Entry::getValue).max(Comparator.naturalOrder()).get();

        List<String> results = map.entrySet().stream()
                .filter(m -> m.getValue() == max)
                .map(Map.Entry::getKey)
                .sorted(Comparator.naturalOrder())
                .collect(Collectors.toList());

        results.forEach(System.out::println);
    }
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
char s[353531];

int main(){
  scanf("%d%s",&n,s);
  int ans = n;
  int lr = 0, rl = 0;
  REP(i,n)if(s[i]=='E')rl++;
  REP(i,n){
    if(s[i]=='E')rl--;
    CHMIN(ans, lr+rl);
    if(s[i]=='W')lr++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    for(int i = 0; i < 3; i++){
        if(s[i] == '1') s[i] = '9';
        else s[i] = '1';
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int a,b,c;
  scanf("%d %d %d", &a, &b, &c);
  if (a == b+c || b == c+a || c == a+b) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 128
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import coo_matrix

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

P = set()
for j in [1, 2]:
  iXY.sort(key=lambda a: a[j])
  for i in range(1, N):
    i0, x0, y0 =  iXY[i - 1]
    i1, x1, y1 =  iXY[i]
    P.add((min(abs(x1 - x0), abs(y1 - y0)), i0, i1))

d, i, j = zip(*P)
G = coo_matrix((d, (i, j)), shape=(N, N))
mst = minimum_spanning_tree(G)
print(int(mst.sum()))

Measured memory_bytes: 82136
n = int(input())
data_list = []
for i in range(2):
    data_list.append([int(data) for data in input().split()])
score_list = []
for j in range(n):
    score = 0
    for k in range(j + 1):
        score += data_list[0][k]
    for k in range(j, n):
        score += data_list[1][k]
    score_list.append(score)
print(max(score_list))


Measured memory_bytes: 3060
#include <iostream>
#include<string>
#include<algorithm>
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
    int n;
    cin>>n;
    double a[n],ans=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    ans=a[0];
    for(int i=1;i<n;i++){
        //cout<<a[i];
        ans=(a[i]+ans)/2;
//         cout<<ans<< " "; 
    }
    
    cout<<ans<<'\n';
  
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 998244353;
ll mul(ll a, ll b){
    return ((a%mod) * (b%mod))%mod;
}
ll power(ll a, ll b){
    ll z = 1; ll x = a;
    while(b>0){
        if (b&1)z = mul(z, x);
        x = mul(x, x);
        b >>= 1;
    }
    return z;
}
int main()
{
    //dsf
    int n;
    cin>>n;
    int temp = 0;
    while(temp < n)temp+=1000;
    cout<<temp-n<<endl;
}


Measured memory_bytes: 3644
//problem_d.go

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	//"strings"
)

const (
	mod = int(1e9) + 7
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

// -----------------------------------------

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getIntSlice(n int) []int {
	ns := []int{}
	for i := 0; i < n; i++ {
		ns = append(ns, getInt())
	}
	return ns
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func getStringSlice(n int) []string {
	ss := []string{}
	for i := 0; i < n; i++ {
		ss = append(ss, getString())
	}
	return ss
}

// -----------------------------------------

// Sort Fanction

func sortIntSlice(ns []int) []int {
	sort.Sort(sort.IntSlice(ns))
	return ns
}

func rsortIntSlice(ns []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(ns)))
	return ns
}

// -----------------------------------------

// Num Fanction

//numModPow(a, n, m) == a^n % m
func numModPow(a int, n int, m int) int {
	result := 1

	for n > 0 {
		if n%2 == 1 {
			result = (result * a) % m
		}

		a = (a * a) % m
		n >>= 1
	}

	return result
}

// numGcd(a, b) == gcd(a, b)
func numGcd(a int, b int) int {
	if b == 0 {
		return a
	}

	return numGcd(b, a%b)
}

// numLcm(a, b) == lcm(a, b)
func numLcm(a int, b int) int {
	return a * b / numGcd(a, b)
}

// numModInv(a, p) == a^(-1) % p
func numModInv(a int, p int) int {
	if a == 1 {
		return 1
	} else {
		return p - numModInv(p%a, p)*(p/a)%p
	}
}

// -----------------------------------------

func solve() {

	n := getInt()
	ns := getIntSlice(n)

	var count_table [2*int(1e5) + 10]int
	s := 0

	for i := 0; i < n; i++ {
		count_table[ns[i]]++
	}

	for i := 1; i <= n; i++ {
		if count_table[i] >= 2 {
			s += count_table[i] * (count_table[i] - 1) / 2
		}
	}

	for i := 0; i < n; i++ {
		fmt.Fprintln(wr, s-(count_table[ns[i]]-1))
	}
}

// -----------------------------------------

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}


Measured memory_bytes: 12160
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define rep1(i,s,e) for(int i=s;i<e;i++)
#define rep2(i,s,e,c) for(int i=s;i>=e;i--)
#define pfi(x) printf("%d\n",x)
#define pfl(x) printf("%lld\n",x)
#define pfn() printf("\n")
#define pfs() printf(" ")
#define sfi(x) scanf("%d",&x)
#define sfi1(x,y) scanf("%d%d",&x,&y)
#define sff(x) scanf("%lf",&x)
#define sfl(x) scanf("%lld",&x)
#define memset1(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
const int MAX = 1e4 + 50;
const int mod = 996873654;
int main(){
	int M,D;
	cin>>M>>D;
	int ans=0;
	for(int i=1;i<=M;i++){
		for(int j=1;j<=D;j++){
			int d1=j%10,d2=j/10;
			if(d1>=2&&d2>=2&&d1*d2==i){
				ans++;
			}
		}
	}
	pfi(ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
const int MAXN = 500050;
 
char s[MAXN];
int ans, l, r, n, a[MAXN];
 
inline bool chk(int x)
{
	int len = n, sum = 0;
	for( int i = 1 ; i <= n ; i++ ) a[ i ] = ( s[ i ] - '0' ) * 9;
	a[ 1 ] += 9 * x;
	for( int i = 1 ; i <= len ; i++ )
		if( a[ i ] > 9 )
		{
			if( i == len ) a[ ++len ] = 0;
			a[ i + 1 ] += a[ i ] / 10;
			a[ i ] %= 10;
		}
	for( int i = 1 ; i <= len ; i++ ) sum += a[ i ];
	return sum <= 9 * x;
}
 
int main() {
	scanf( "%s", s + 1 );
	l = 1, r = n = strlen( s + 1 );
	reverse( s + 1, s + n + 1 );
	while( l <= r )
	{
		int mid = l + r >> 1;
		if( chk( mid ) ) ans = mid, r = mid - 1;
		else l = mid + 1;
	}
	cout << ans << endl;
}

Measured memory_bytes: 2688
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int x, y;
    
    while(1){
        scanf("%d %d", &x, &y);
        if (x == 0 && y == 0) {
            break;
        }
        if (x>y) {
            printf("%d %d\n", y, x);
        }else
            printf("%d %d\n", x, y);
    }
        return 0;
}



Measured memory_bytes: 2020
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
ans = True
if b - a > k:
    ans = False
if c - a > k:
    ans = False
if d - a > k:
    ans = False
if e - a > k:
    ans = False
if c - b > k:
    ans = False
if d - b > k:
    ans = False
if e - b > k:
    ans = False
if d - c > k:
    ans = False
if e - c > k:
    ans = False
if e - d > k:
    ans = False
if ans:
    print("Yay!")
else:
    print(":(")

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
int s(int n)
{
    int sum=0;
    while(n!=0)
    {
        sum+=n%10;
        n/=10;
    }
    return sum;
}
int main()
{
    int n,a,b;
    cin>>n>>a>>b;
    long long sum=0;
    for(int i=1;i<=n;i++)
    {
        if(s(i)>=a&&s(i)<=b)
            sum+=i;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
b = []
for i in range(3):
  lst = list(map(int,input().split()))
  b.append(lst)
n = int(input())
for i in range(n):
  a = int(input())
  for j in range(3):
    for k in range(3):
      if (b[j][k] == a):
        b[j][k] = 0
if (b[0][0] == b[0][1] == b[0][2] or b[1][0] == b[1][1] == b[1][2] or b[2][0] == b[2][1] == b[2][2] or b[0][0] == b[1][0] == b[2][0] or b[0][1] == b[1][1] == b[2][1] or b[0][2] == b[1][2] == b[2][2] or b[0][0] == b[1][1] == b[2][2] or b[0][2] == b[1][1] == b[2][0]):
  print("Yes")
else:
  print("No")
  


Measured memory_bytes: 9276
#include <bits/stdc++.h>
#define N 200005
using namespace std;

int a[N], T[N], len;
char s[N];

int main() {
    scanf("%s", s + 1);
    len = strlen(s + 1);
    for (int i = 1; i <= len; ++i)
        a[i] = s[i] == 'B' ? 1 : 0;
    long long ans = 0, tmp = 0;
    for (int i = len; i >= 1; --i)
        if (a[i] == 0) tmp++;
        else ans += tmp;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int X, Y;

    cin >> X >> Y;

    string A = "Yes";

    if (Y % 2 != 0)
    {

        A = "No";
    }

    if (Y > X * 4)
    {
        A = "No";
    }

    if (X >= 51)
    {
        A = "No";
    }

    if (X * 2 > Y)
    {
        A = "No";
    }

    cout << A << endl;
}

Measured memory_bytes: 3600
//どうしてもフェネちゃん VS きすけくん にしたかった..........

/*  include  */
#include <cstdio>
#include <vector>
/*  using namespace  */
using namespace std;

/*  local var  */
vector<int> グラフ[100005];

/*  define  */
#define loop(i,j) for(int i = 0; i < j; i++)

/*  typedef  */
typedef long long ll;

/*  function  */
void dfs(int マス,int 前回いた場所,int 距離差,int 距離配列[])
{
	/*  距離差の設定  */
	距離配列[マス]=距離差;
	loop(i,グラフ[マス].size()){
		/*  前回いた場所でなければ行ってないので行く  */
		if(グラフ[マス][i] != 前回いた場所 ) dfs(グラフ[マス][i],マス,距離差+1,距離配列);
	}
}

/*  main program  */
int main()
{	
	int フェネック[100005];	
	int きすけ[100005];
	int マス数;
	int 連結A,連結B;
	int フェネちゃんが塗れるマス数=0;

	scanf("%d",&マス数);

	loop(i,マス数-1){
		scanf("%d %d",&連結A,&連結B);
		連結A--,連結B--;		 //連結A 連結Bの数を一つ減らし、0からマス数-1の数で表現
		グラフ[連結A].push_back(連結B);	 //グラフに辺を追加する この時点では「有向グラフ(AからBにしか行けない)」
		グラフ[連結B].push_back(連結A);	 //上記同様。「BからAへの辺を追加して無向グラフにする」
	}

	dfs(0,-1,0,フェネック);			 //フェネちゃんはマス0からスタート。スタートなので前回いたところは -1 とする。 距離差はもちろん0
	dfs(マス数-1,-1,0,きすけ);		 //上記同様。ただし きすけくんはマス数-1の数からのスタートなので マス数-1からスタートする。
	loop(i,マス数){
		 //フェネちゃんは先手だから「自分がiマス目に到着する手数が相手の手数"以下"であれば良い。」
		(フェネック[i]<=きすけ[i])?フェネちゃんが塗れるマス数++:フェネちゃんが塗れるマス数--;
	}
	/*後は塗った数が同数であった場合、フェネちゃんが塗れなくなるためきすけくんの勝利とすればよい。*/
	printf("%s\n",(フェネちゃんが塗れるマス数>0)?"Fennec":"Snuke");
	
}


Measured memory_bytes: 12800
import numpy as np
h,w=map(int,input().split())
maze=[]
for i in range(h):
  s=list(input())
  if s.count(".")==len(s):continue
  maze.append(s)
maze=np.array(maze).T
ans=[]
for i in range(10**5):
  try:q=maze[i]
  except:break  
  if all(x=="." for x in q):
      continue
  ans.append(q)
ans=((np.array(ans).T).tolist())
for i in ans:
  for j in i:
    print(j,end="")
  print()

Measured memory_bytes: 13920
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
for x in range(1, N + 1):
    val = x * 108
    val -= val % 100
    if val == N * 100:
        print(x)
        exit()
print(":(")



Measured memory_bytes: 9500
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

//Filling Game
public class Main{
	
	int h, w, N, res;
	int[][] a, id;
	int[][] d = {{-1,0},{0,1},{1,0},{0,-1}};
	Set<Integer>[] adj;
	int[] col, bfs;
	boolean[] u;
	
	boolean ok(int i, int j){
		return 0<=i&&i<h&&0<=j&&j<w;
	}
	
	void fill(int i, int j, int ID, int col){
		a[i][j] = -1;
		id[i][j] = ID;
		for(int k=0;k<4;k++){
			int ni = i+d[k][0], nj = j+d[k][1];
			if(ok(ni, nj)&&a[ni][nj]==col)fill(ni, nj, ID, col);
		}
	}
	
	@SuppressWarnings("unchecked")
	void f(int depth, int sum){
		if(sum==N){
			res = depth; return;
		}
		Arrays.fill(bfs, 1<<29);
		Queue<Integer> q = new LinkedList<Integer>();
		for(int i=0;i<N;i++)if(u[i]){
			bfs[i] = 0; q.add(i);
		}
		int max = 0;
		while(!q.isEmpty()){
			int v = q.poll();
			for(int x:adj[v]){
				if(bfs[x]==1<<29){
					bfs[x] = bfs[v]+1; q.add(x);
					max = Math.max(max, bfs[x]);
				}
			}
		}
		if(res<=depth+max)return;
		Set<Integer>[] nx = new Set[3];
		for(int i=0;i<3;i++)nx[i]=new HashSet<Integer>();
		for(int i=0;i<N;i++)if(u[i]){
			for(int x:adj[i]){
				if(!u[x])nx[col[x]].add(x);
			}
		}
		for(int c=0;c<3;c++)if(!nx[c].isEmpty()){
			for(int x:nx[c])u[x]=true;
			f(depth+1, sum+nx[c].size());
			for(int x:nx[c])u[x]=false;
		}
	}
	
	@SuppressWarnings("unchecked")
	void run(){
		Scanner sc = new Scanner(System.in);
		adj = new Set[150];
		for(;;){
			w = sc.nextInt(); h = sc.nextInt();
			if((w|h)==0)break;
			a = new int[h][w];
			id = new int[h][w];
			for(int i=0;i<h;i++)for(int j=0;j<w;j++){
				char c = sc.next().charAt(0);
				a[i][j] = c=='R'?0:c=='G'?1:2;
			}
			N = 0;
			col = new int[h*w];
			for(int i=0;i<h;i++)for(int j=0;j<w;j++)if(a[i][j]!=-1){
				col[N] = a[i][j];
				fill(i, j, N, a[i][j]);
				N++;
			}
			for(int i=0;i<N;i++)adj[i] = new HashSet<Integer>();
			for(int i=0;i<h;i++)for(int j=0;j<w;j++){
				for(int k=0;k<4;k++){
					int ni = i+d[k][0], nj = j+d[k][1];
					if(ok(ni, nj)&&id[i][j]!=id[ni][nj])adj[id[i][j]].add(id[ni][nj]);
				}
			}
			res = N;
			u = new boolean[N];
			u[0] = true;
			bfs = new int[N];
			f(0, 1);
			System.out.println(res);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 13000
n = int(input())
c = [0, 0]
for i in range(n):
    t, h = input().split()
    if t == h:
        c[0] += 1
        c[1] += 1
    elif t > h:
        c[0] += 3
    else:
        c[1] += 3
print(c[0], c[1])


Measured memory_bytes: 5600
#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int n, m;
    cin >> n >> m;

    vi a(m), b(m);
    REP(i, m) cin >> a[i] >> b[i];
    REP(i, m) a[i]--, b[i]--;

    vector<vi> edge(n);
    REP(i, m) {
        edge[a[i]].eb(b[i]);
        edge[b[i]].eb(a[i]);
    }

    vector<bool> used(n, false);
    used[a[0]] = true;
    used[b[0]] = true;


    auto dfs = [&](auto &&f, int cur, vi& ans) -> void {
        for(auto &e: edge[cur]) {
            if (used[e]) continue;

            used[e] = true;
            ans.pb(e);
            f(f, e, ans);
            return;
        }
    };

    vi ans = {a[0], b[0]};
    dfs(dfs, b[0], ans);

    reverse(ALL(ans));
    dfs(dfs, a[0], ans);

    print(ans.size());
    for(int i = 0; i < ans.size(); i++) {
        if (i > 0) cout << " ";
        cout << ans[i] + 1;
    }

    cout << "\n";

}

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

int main() {
	int n, d;
	cin >> n >> d;
	int result = 0;
	for (int i = 0; i < n; i++) {
		long long x, y;
		cin >> x >> y;
		if (x * x + y * y <= (long long)d * d)
			result++;
	}
	cout << result;
}


Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926

typedef long long int ll;

//ll num[50];
//ll num2[50];
ll num[10];
//set<ll> sll;
//map<string,ll> mp,mp1;
//map<string,ll>::iterator iter;


int main(void)
{
    long long int sum=0,range=0,ceiling;
    double ans=0.0,d;
    long long int m,n,o,i,j,k=1,money;
    long long int a,a1=0,a2=0,a3=0,ar=1,as=1,at1;
    string s;
    char c;
    a=a1=a2=a3=0;
    //vector <int> v;
    //float f,g,h;
    //int c,d,big=0;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>a1>>a2;
        if(a1==1&&a2==0&&n!=1)
        {
            cout<<"-1";
            return 0;
        }
        if(num[a1]==0)
        {
            num[a1]=a2;
        }
        else
        {
            if(num[a1]!=a2)
            {
                cout<<"-1";
                return 0;
            }
        }
    }
    if(num[1]==0&&n!=1) num[1]=1;
    for(i=n;i>0;i--)
    {
        sum+=num[i]*ar;
        ar*=10;
    }
    cout<<sum;
    return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define CFS           \
    cin.tie(nullptr); \
    ios::sync_with_stdio(false);
#define CST(x) cout << fixed << setprecision(x);
using namespace std;
constexpr int IINF = numeric_limits<int>::max();
constexpr long LINF = numeric_limits<long>::max();
constexpr int MOD = (int)1e9 + 7;
// constexpr int MOD = 998244353;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<bool> v(n, true);
    for (size_t i = 0; i < k; i++) {
        int d;
        cin >> d;
        for (size_t j = 0; j < d; j++) {
            int a;
            cin >> a;
            v[a - 1] = false;
        }
    }
    int ans = accumulate(v.begin(), v.end(), 0);
    cout << ans << "\n";
}

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

int main(void){
  int n; cin >> n;
  vector< pair<int,int> > date;
  vector<int> happy(n, 100);
  int ans = 0;
  for(int i=0; i < n; i++){
    int a, b; cin >> a >> b;
    date.push_back(make_pair(a,b));
  }
  for(int day = 1; day <= 31; day++){
    int watching = INT_MAX;
    int w = -1;
    for(int i=0; i < n; i++){
      if(date[i].first <= day && day <= date[i].second){
        if(watching > date[i].second && happy[i] == 100){
          w = i;
          watching = date[i].second;
        }
      }
    }
    if(w == -1){
      for(int i=0; i < n; i++){
        if(date[i].first <= day && day <= date[i].second){
          ans += 50;
          break;
        }
      }
    }else{
      ans += happy[w];
      happy[w] = 50;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1200