akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,a) for(int (i)=0; (i)<(a); (i)++)
#define rep2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define all(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
#define chmax(a,b) if(b>a) a = b
#define chmin(a,b) if(b<a) a = b
typedef long long ll;
using namespace std;

using namespace std;

int main(){
        ios_base::sync_with_stdio(false); 
        cin.tie(NULL);
        ll x1,x2,x3,x4,x5; cin >> x1 >> x2 >> x3 >> x4 >> x5;
        if(x1 == 0) cout << "1" << endl;
        if(x2 == 0) cout << "2" << endl;
        if(x3 == 0) cout << "3" << endl;
        if(x4 == 0) cout << "4" << endl;
        if(x5 == 0) cout << "5" << endl;

        return 0;
}


Measured memory_bytes: 3604
def f(x):
    joi = 0
    ioi = 0
    for i in range(len(x)):
        
        if x[i:i+3] == "JOI":
            joi += 1
        elif x[i:i+3] == "IOI":
            ioi += 1
    print(joi)
    print(ioi)

while True:
    try:
        s = input()
        f(s)
    except:
        exit()


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

int f(int n) {
  int m = 0;
  while (n) m += n % 10, n /= 10;
  return m;
}

int main() {
  int N;
  cin >> N;
  cout << ((N % f(N)) ? "No" : "Yes") << "\n";
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll n, k; cin>>n>>k;
	if (k==1){
		cout << "0\n";
	}else{
		cout << n-k << "\n";
	}
	return 0;
}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}

int main() {
  int count=0,ans=0;
  string s;
  cin>>s;
  rep(i,s.size()){
    if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
      count++;
    }else{
      ans=max(ans,count);
      count=0;
    }
  }
  ans=max(ans,count);
  cout<<ans<<endl;
  
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

void solve()
{
    int n;
    scanf("%d", &n);
    int i;
    for(i=0; i<n; i++) {
        int tmp;
        scanf("%d", &tmp);
        if(tmp%2==0) {
            if(tmp%3!=0 && tmp%5!=0)
                break;
        }
    }
    if(i<n) {
        printf("DENIED\n");
    }
    else {
        printf("APPROVED\n");
    }
    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define db(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl;
#define ll long long
#define ld long double
#define pll pair<ll, ll>
#define MOD 1000000007
#define FOR(i, n) for(ll i = 0; i < n; i++)
using namespace std;
const long long INF = 3*1e18;

int main() {
    ios::sync_with_stdio(0);    
    cin.tie(0);
    string s;
    cin >> s;
    if(s == "ABC") cout << "ARC\n";
    else cout << "ABC\n";
}

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

using namespace std;

#define ll long long




void solve() {

	string a, b;
	cin >> a >> b;
	int cnt = 0;
	for(int i = 0; i < a.length(); i++) {
		if(a[i] == b[i]) {
			cnt++;
		}
	}
	cout << cnt;

	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	solve();

	return 0;
}

Measured memory_bytes: 3648
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>

using namespace std;

bool f[21][21];
char tile[21][21];
int w,h;

int dfs(int x,int y)
{
	if(x < 0 || y < 0 || x >= h || y >= w || f[x][y] || tile[x][y] == '#')return 0;
	
	f[x][y] = true;

	int sum = 0;

	sum += dfs(x-1,y);
	sum += dfs(x+1,y);
	sum += dfs(x,y-1);
	sum += dfs(x,y+1);

	return sum + 1;
}



int main()
{

	
	while(cin >> w >> h && w && h)
	{
		
		memset(tile,0,21*21*sizeof(char));
		memset(f,0,21*21*sizeof(bool));

		int sx,sy;

		for(int i = 0;i < h;i++)
		{
			for(int j = 0;j < w;j++)
			{
				cin >> tile[i][j];
				if(tile[i][j] == '@'){sx = i;sy = j;}
			}
		}

		cout << dfs(sx,sy) << endl;


	}


	return 0;
}

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

#define int64 long long
#define pii pair <int64, int64>
#define fr first
#define sc second
#define heap priority_queue
struct piii{
    int64 fr, sc, th;
    bool operator < (const piii &b){
        if (fr != b.fr) return fr < b.fr;
        if (sc != b.sc) return sc < b.sc;
        return th < b.th;
    }
};
///////////////////////////////////////////////
///////////////////////////////////////////////

int n, k, sum;
int a[505], b[505];
vector <int> d;

bool check(int d){
    int sumd = 0, sumk = 0;
    for (int i = 0; i < n; i++){
        b[i] = a[i] % d;
        sumd += b[i];
        sumk += b[i];
    }
    sort(b, b + n);
    //cout << d << ' ' << sumd << ' ' << sumk << "     "; for (int i = 0; i < n; i++) cout << b[i] << ' '; cout << endl;
    for (int i = n - 1; i >= 0; i--){
        if (sumd == 0 && sumk <= k) return 1;
        sumk = sumk - b[i];
        sumd -= d;
        if (sumd == 0 && sumk <= k) return 1;
    }
    return 0;
}

int main(){
    cout << setprecision(2) << fixed;
    ios::sync_with_stdio(false), cin.tie(0);
    //freopen("input.txt", "r", stdin);
    cin >> n >> k;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    for (int i = 1; i * i <= sum; i++)
    if (sum % i == 0){
        d.push_back(i);
        d.push_back(sum / i);
    }
    sort(d.begin(), d.end());
    for (int i = d.size() - 1; i >= 0; i--)
    if (check(d[i])){
        cout << d[i];
        break;
    }
    return 0;
}


Measured memory_bytes: 256
let readString() = stdin.ReadLine()
let readStringArray() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringArray() |> Array.map (fun x -> int x)


let n = readString()

if n.Contains("9") then "Yes" else "No"
|> printfn "%s"

Measured memory_bytes: 13916
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
	// http://abc106.contest.atcoder.jp/tasks/abc106_c
	public class Abc106_c
	{
#if !Development
		public static void Main(string[] args)
		{
			Abc106_c.Solve(args);
		}
#endif

		/*
		 S
 は 
1
 文字以上 
100
 文字以下の文字列.
K
 は 
1
 以上 
10
18
 以下の整数.
5000
 兆日後の文字列の長さは 
K
 文字以上である.
		 * */

		public static void Solve(string[] args)
		{
			var s = ReadLineStringOne();
			var k = ReadLineLongOne();

			var 五千兆 = 5000L * 10000 * 10000 * 10000;

			var c = s.Select(x => int.Parse(x.ToString()));

			foreach(var digit in c)
			{
				if (digit > 1)
				{
					Console.WriteLine(digit);
					return;
				}

				k--;
				if(k == 0)
				{
					Console.WriteLine("1");
					return;
				}
			}
		}

		public static string ReadLineStringOne() { return Console.ReadLine(); }
		public static List<string> ReadLineString() { return Console.ReadLine().Split(' ').ToList(); }
		public static List<int> ReadLineInt() { return Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToList(); }
		public static int ReadLineIntOne() { return Console.ReadLine().Split(' ').Select(str => int.Parse(str)).First(); }
		public static List<int> MultiReadLineInt(int lineNum) { return Enumerable.Range(0, lineNum).Select(_ => ReadLineIntOne()).ToList(); }
		public static long ReadLineLongOne() { return Console.ReadLine().Split(' ').Select(str => long.Parse(str)).First(); }
	}
}

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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int n;
    cin>> n;
    cout<< n*n*n;
    nl;
    

    return 0;
}




Measured memory_bytes: 3656
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int a, b, t; cin >> a >> b >> t;
  int ans = 0;
  FOR(ti, 1, t + 1) {
    if (ti % a == 0) ans += b;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <limits>
#include <string>
#include <bitset>
#include <functional>
#include <iomanip>

using namespace std;
using lint = long long;
using vb = vector<bool>;
using vi = vector<int>;
using vl = vector<int>;
using pii = pair<int, int>;
using pll = pair<lint, lint>;
using pqi = priority_queue<int>;
using pql = priority_queue<lint>;
#define mii = map<int, int>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n); i > 0; i--)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define repf(i, f, n) for (int i = (f); i < (n); i++)
#define mp(x, y) make_pair((x), (y))
#define pb(x) push_back((x))
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define foreach(it, x) for (auto it = (x).begin(); it != (x).end(); it++)
#define space (char)0x20

constexpr lint MOD = 1e9 + 7;
int A, B, C, D, E, F, G, H, I, J, K, L, M, N;
int O, P, Q, R, S, T, U, V, W, X, Y, Z;
string s;
lint ans = 0;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	cin >> N;
    rep1(i, N-1) {
        ans += i;
    }

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

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



ll N, M;

vector<int> next_node[100000];

int main(){
	cin >> N >> M;
	
	for ( int i = 0; i < M; i++ ){
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		next_node[u].push_back(v);
	}
	
	int S, T;
	cin >> S >> T;
	S--;
	T--;
	
	queue<pair<int,int>> q;
	map<int,bool> visit[3]; // 到達予定なら、印をつける
	
	q.push({S,0});
	while ( !q.empty() ){
		auto a = q.front();
		q.pop();
		int node = a.first;
		int step = a.second;
		
		if ( step % 3 == 0 ){
			if ( node == T ){
				cout << step/3 << endl;
				return 0;
			}
		}
		
		step++;
		for ( auto it : next_node[node] ){
			if ( visit[step%3][it] )
				continue;
			visit[step%3][it] = true;
			q.push({it,step});
		}
	}
	
	cout << -1 << endl;
	return 0;
}



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

int main() {
  int N;
  std::cin >> N;
  
  int t = N, c = 0;
  while (true){
    c += t%10;
    t = t/10;
    if (t <= 0){
      break;
    }
  }
  
  if (N % c == 0){
    std::cout << "Yes" << std::endl;
  }
  else{
    std::cout << "No" << std::endl;
  }
}


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

set<int>s;
//vector<int>v;

int main(){
   int b;
   int a;

   cin >> b;
   int n = b;
	while(b !=  0){
		a = b % 10;
	//	v.push_back(a);
		s.insert(a);
		b /= 10;
	}
  //  cout << s.size() << endl;
	if(s.size() == 1){
		cout << n;
	}
	else if(n < 111){
		cout << 111;
	}
	else if(n < 222 && n > 111 ){
		cout << 222;
	}
	else if(n < 333 && n > 222 ){
		cout << 333;
	}
	else if(n < 444 && n > 333 ){
		cout << 444;
	}
	else if(n < 555 && n > 444 ){
		cout << 555;
	}
	else if(n < 666 && n > 555 ){
		cout << 666;
	}
	else if(n < 777 && n > 666 ){
		cout << 777;
	}
	else if(n < 888 && n > 777 ){
		cout << 888;
	}
	else if(n < 999 && n > 888 ){
		cout << 999;
	}



	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int area = a * b;
        int length = 2 * a + 2 * b;
        System.out.println
                (area + " " + length);
        sc.close();
    }
}


Measured memory_bytes: 25980
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;
// const int MOD = 998244353;

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

   int n, k, c;
   cin >> n >> k >> c;
   string s;
   cin >> s;

   auto getPositions = [&]() {
      vector<int> res;
      for (int i = 0; i < n && res.size() < k;) {
         if (s[i] == 'o') {
            res.push_back(i);
            i += c + 1;
         } else {
            i++;
         }
      }
      return res;
   };
   vector<int> l, r;
   rep(ri, 0, 2) {
      if (ri == 0)
         l = getPositions();
      else {
         r = getPositions();
         rep(i, 0, k) r[i] = n - 1 - r[i];
      }
      reverse(s.begin(), s.end());
   }
   vector<int> lastL(n + 1, -1);
   rep(i, 0, k) lastL[l[i] + 1] = i;
   rep(i, 1, n) {
      if (lastL[i] == -1) lastL[i] = lastL[i - 1];
   }
   vector<int> lastR(n + 1, -1);
   rep(i, 0, k) lastR[r[i]] = i;
   rrep(i, n - 1, 0) {
      if (lastR[i] == -1) lastR[i] = lastR[i + 1];
   }
   rep(i, 0, n) {
      if (s[i] == 'x') continue;
      int li = lastL[i];
      int ri = lastR[i + 1];
      int cnt = 0;
      if (li != -1) cnt += li + 1;
      if (ri != -1) cnt += ri + 1;
      if (li != -1 && ri != -1 && r[ri] - l[li] <= c) cnt--;
      if (cnt >= k) continue;
      cout << i + 1 << endl;
   }
   return 0;
}

Measured memory_bytes: 5004
import kotlin.math.max

fun main(args: Array<String>) {
    val (n, m) = readIntList()

    val uf = UnionFind(n)
    repeat(m) {
        val (a, b) = readIntList().map { it - 1 }
        uf.unite(a, b)
    }

    var ans = 0
    for (i in 0 until n) {
        ans = max(ans, uf.size(i))
    }
    println(ans)
}

// read
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

class UnionFind(size: Int) {
    private val r: MutableList<Int> = MutableList(size) { -1 }

    fun root(x: Int): Int {
        if (r[x] < 0) return x
        r[x] = root(r[x])
        return r[x]
    }

    fun unite(x: Int, y: Int): Boolean {
        var x = root(x)
        var y = root(y)
        if (x == y) return false
        if (r[x] > r[y]) x = y.also { y = x }
        r[x] += r[y]
        r[y] = x
        return true
    }

    fun size(x: Int): Int = -r[root(x)]
}

Measured memory_bytes: 65260
#include <cstdio>
#include <utility>
#include <unordered_map>
using namespace std;

#define gcu getchar_unlocked
#define ii inline int in
#define bs inline bool scan
ii(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
ii() {return in(gcu());}
bs(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bs(char &c){c=gcu();gcu();return c!=EOF;}
// bs(string &s){int c; s = "";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#undef ii
#undef bs
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
// vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
vo(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T>
//vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef vo

int main() {
	unordered_map<char, int> mp = {{'I', 1}, {'V', 5},
		{'X', 10}, {'L', 50}, {'C', 100}, {'D', 500}, {'M', 1000}};
	for (char c; (c = gcu()) != EOF;) {
		int n = 0, m = mp[c];
		for (;(c = gcu()) != '\n';)
			if (m && m < mp[c])
				n += mp[c] - m, m = 0;
			else
				n += m, m = mp[c];
		n += m;
		out(n, '\n');
	}
}


Measured memory_bytes: 2428
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_set>
# include <unordered_map>
using namespace std;

int n, m;
string s[105];
bool used[105];

int main(int argc, const char * argv[]) {
    #ifdef __APPLE__
        freopen("/Users/danya.smelskiy/Documents/Danya/Resources/input.txt","r",stdin);
        //freopen("/Users/danya.smelskiy/Documents/Danya/Danya/output.out", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        cin >> s[i];
    }
    for (int j = 0; j < m; ++j) {
        bool t = false;
        for (int i = 1; i <= n; ++i)
            if (s[i][j] == '#') {
                t = true;
                break;
            }
        if (!t) used[j] = true;
    }
    for (int i = 1; i <= n; ++i) {
        bool t = false;
        for (int j = 0; j < m; ++j)
            if (s[i][j] == '#') {
                t = true;
                break;
            }
        if (!t) continue;
        for (int j = 0; j < m; ++j)
            if (!used[j]) cout << s[i][j];
        cout << '\n';
    }
    return 0;
    
}



Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main(void){

	int X,i,j,k,a=0;

	scanf("%d",&X);

		for(j=(int)sqrt(X);j>0;j--)
			for(k=2;(pow(j,k)<=X)&&(k<=9);k++)
				if(pow(j,k)<=X&&pow(j,k)>a)
					a=pow(j,k);

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

	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(){

	int a,b;

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

	if((a+b)%2==0){
	printf("%d\n",(a+b)/2);
	}
	else{
	printf("%d\n",((a+b)/2)+1);
	}

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fastIO ios::sync_with_stdio(NULL); cin.tie(NULL);
 
using namespace std;
const int N = 1E6+7;
const long long INF = 1E18;
 
long long f[N][4];
long long a[N], b[N], c[N];
int n;
 
int main()
{
    fastIO;
    cin>>n;
    
    for (int i = 1;i <= n;++i) cin>>a[i]>>b[i]>>c[i];
    
    for (int i = 1;i <= n;++i)
    {
        f[i][1] = max(f[i-1][2]+a[i],f[i-1][3]+a[i]);
        f[i][2] = max(f[i-1][1]+b[i],f[i-1][3]+b[i]);
        f[i][3] = max(f[i-1][1]+c[i],f[i-1][2]+c[i]);
    }

    
    long long res = -INF;
    for (int i = 1;i <= 3;++i) res = max(res,f[n][i]);
    
    cout<<res;
}


Measured memory_bytes: 9136
#include<bits/stdc++.h>
using namespace std;
int n,x,temp,ans;
inline int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
int main(){
    scanf("%d%d",&n,&x);
    for(register int i=1;i<=n;i++){
        scanf("%d",&temp);
        temp=temp<x?(x-temp):(temp-x);
        ans=gcd(ans,temp);
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
  int count=0;
  int i;
  char s[16];
  cin >> s;
  for(i=0;;i++) {
    if(s[i] == '\0')break;
    if(s[i] == 'x')count++;
  }
  if(count < 8)cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

int main(){
	int n,k;
	long long ans=1;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		if(i==0){
			ans*=k;
		}
		else{
			ans*=k-1;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import { readFileSync } from 'fs'
import { reverse } from 'dns'
import { start } from 'repl'

function divCnt(n : number) : number {
  let ans = 0
  for (let i = 1; i <= Math.sqrt(n); i++) {
    if (n % i == 0) {
      ans++
      if (i * i != n) {
        ans++
      }
    }
  }
  return ans
}

function main(input: string[]) {
  let N = Number(input[0])
  let ans = BigInt(0)

  // 1 : 1
  // 2 : 1 2
  // 3 : 1   3 
  // 4 : 1 2   4
  // 5 : 1        5
  // 6 : 1 2 3      6
  // 7 : 1            7
  // 8 : 1 2   4        8
  for (let i = 1; i <= N; i++) {
    let cnt = Math.floor(N / i)
    let ansOne = (cnt * (cnt + 1) / 2) * i
    ans += BigInt(ansOne)
  }

  console.log(ans.toString())
}

let lines: string[] = [];
const reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', function (line: string) {
  lines.push(line);
});
reader.on('close', function () {
  main(lines)
});


Measured memory_bytes: 36120
n=int(input())
s=list(map(int,input().split()))
q=int(input())
t=list(map(int,input().split()))
ans=0
for i in range(q):
    tmp=t[i]
    l=0
    r=len(s)-1
    mid=(l+r)//2
    while l<=r:
        if tmp==s[mid]:
            ans+=1
            break
        elif s[mid]>tmp:
            r=mid-1
        else:
            l=mid+1
        mid=(l+r)//2
print(ans)


Measured memory_bytes: 16704
a, b, c = list(map(int, input().split()))
if a%2 or b%2 or c%2:
    print("0")
    exit()
aa = [a, (b+c)/2]
bb = [b, (c+a)/2]
cc = [c, (a+b)/2]
ans = []
for li in [aa,bb,cc]:
    DP = li
    if DP[0] == DP[1]:
        can = -1
        ans.append(can)
        continue
    can = 1
    while True:
        next = sum(DP)
        if next %2:
            break
        else:
            DP = [DP[0], next/2]
            can += 1
    ans.append(can)

hoge = -1
ans.sort()
for i in ans:
    if i > 0:
        hoge=i
        break
print(hoge)

Measured memory_bytes: 3064
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
    def group_count(self):
        return len(self.roots())

import sys
input=sys.stdin.readline
n,m,k = map(int, input().split())
f_link = [[] for _ in range(n)]
uf = UnionFind(n)
for i in range(m):
    tmp = list(map(int,input().split()))
    f_link[tmp[0]-1].append(tmp[1]-1)
    f_link[tmp[1]-1].append(tmp[0]-1)
    uf.union(tmp[0]-1,tmp[1]-1)
b_link = [[] for _ in range(n)]
for i in range(k):
    tmp = list(map(int,input().split()))
    b_link[tmp[0]-1].append(tmp[1]-1)
    b_link[tmp[1]-1].append(tmp[0]-1)

ans=[]
for i in range(n):
    fnum=len(f_link[i])
    bnum=len(b_link[i])
    f_cand=uf.size(i)
    b_f_num=0
    for j in b_link[i]:
        if uf.same(i,j):
            b_f_num+=1
    ans.append(f_cand-fnum-b_f_num-1)
print(*ans)

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

long long n, k, cnt=1, ans=1, M=1e9+7;
string s;
int main() {
	int i;
	cin >> n >> s;
	if(s[0]=='W') {puts("0"); return 0;}
	for(i=1; i<2*n; i++) {
		if(s[i] == s[i-1]) k = 1 - k;
		if(k==0) cnt++;
		else ans = ans * cnt % M, cnt--;
	}
	if(cnt!=0) {puts("0"); return 0;}
	for(i=2; i<=n; i++) ans = ans * i % M;
	cout << ans;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>

using namespace std;

int main() {
  int n;
  for ( ; ; ) {
    cin >> n;
    if (n == 0) break;
    vector<int> s(n);
    int t = 0;
    for (int i = 0; i < n; ++i) {
      cin >> s[i];
      t += s[i];
    }
    double m = static_cast<double>(t) / n;

    double v = 0.0;
    for (int i = 0; i < n; ++i) {
      double tmp = s[i] - m;
      v += tmp * tmp;
    }
    v /= n;
    printf("%.8f\n", sqrt(v));
  }
  return 0;
}



Measured memory_bytes: 3204
// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T1, class T2> using P = pair<T1, T2>;
using I = int;
using D = double;
using B = bool;
using C = char;
using S = string;
using LL = long long;
using LD = long double;
using ULL = unsigned long long;
using PII = P<I, I>;
using VPII = V<PII>;
using PLL = P<LL, LL>;
using VPLL = V<PLL>;
using VI = V<I>;
using VVI = VV<I>;
using VLL = V<LL>;
using VVLL = VV<LL>;
using VC = V<C>;
using VVC = VV<C>;
using VS = V<S>;
using VVS = VV<S>;
using VB = V<B>;
using VVB = VV<B>;
#define REP(type, i, n) for (type i = 0; i < (type)(n); ++i)
#define REP2(type, i, m, n) for (type i = (m); i < (type)(n); ++i)
#define REPR(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define REPR2(type, i, m, n) for (type i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a, type) sort(ALL(a), greater<type>())
#define SORTF(a, comp) sort(ALL(a), comp)
#define REVERSE(a) reverse(ALL(a))
#define SIZE(a, type) ((type)(a).size())
#define bit_search(bit, n) REP(LL, bit, 1LL<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) (lower_bound(ALL(a), (x)) - a.begin())
#define bisect_right(a, x) (upper_bound(ALL(a), (x)) - a.begin())
#define INPUT(a) REPx(&x, a) cin >> x;
#define INPUT2(a) REPx(&x, a) INPUT(x);
#define INPUTP(a) REPx(&x, a) cin >> x.first >> x.second;
#define ENDL cout << endl;

// const int INF = 2e9;
const LL INF = 9e18;
const LL MOD = 1e9+7;

template<class T> using PRIORITY_QUEUE = priority_queue< T, V<T>, greater<T> >;
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;}
template<class T> inline void debug1(V<T> A){REP(int, i, SIZE(A, int)){if (A[i] == INF) cout << "I ";else cout << A[i] << " ";}ENDL}
template<class T> inline void debug2(VV<T> A){REP(int, i, SIZE(A, int)){REP(int, j, SIZE(A[i], int)){if (A[i][j] == INF) cout << "I "; else cout << A[i][j] << " ";}ENDL}}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  if (400 <= n && n <= 599) cout << 8 << endl;
  else if (600 <= n && n <= 799) cout << 7 << endl;
  else if (800 <= n && n <= 999) cout << 6 << endl;
  else if (1000 <= n && n <= 1199) cout << 5 << endl;
  else if (1200 <= n && n <= 1399) cout << 4 << endl;
  else if (1400 <= n && n <= 1599) cout << 3 << endl;
  else if (1600 <= n && n <= 1799) cout << 2 << endl;
  else if (1800 <= n && n <= 1999) cout << 1 << endl;


  return 0;
}


Measured memory_bytes: 3648
whs = []

while True:
    hw = list(map(int, input().split()))
    if hw[0] == 0 and hw[1] ==0:
        break
    whs.append(hw)

for i in range(len(whs)):
    h = whs[i][0]
    sqs = "#" * whs[i][1]
    mids = "#" + "." * (whs[i][1] - 2) + "#"
    for j in range(h + 1):
        if j == h:
            print("")
        elif j == 0 or j == h - 1:
            print(sqs)
        else:
            print(mids)


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

int func(int x) {
  if(x%100 != 0) {
    return 0;
  }
  return func(x/100)+1;
}

int main(void) {
  int D, N;
  int cnt = 0;
  cin >> D >> N;
  for(int x=1;;x++) {
    if(func(x) == D) {
      cnt++;
      if(cnt == N) {
        cout << x << endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
//coded b vishal mourya - the legendary coder
#include<bits/stdc++.h>
#define ll long long int
#define vec vector<ll>
#define f(a,b) for(ll i = a ; i < b ; i++ )
#define fj(a,b) for(ll j = a ; j < b ; j++ )
#define fk(a,b) for(ll k = a ; k < b ; k++ )
#define fasthoja ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main(void){
    fasthoja;
    
    ll n; cin >> n;
    vec v(n);
    f(0,n) cin >> v[i];
    vec ans(n);
    ans[0] = v[0];
    // ll min = ans[0];
    f( 1,v.size() ) {
        if( v[i] < ans[i-1] ) {
            ans[i] = v[i];
        }
        else
            ans[i] = ans[i-1];
    }
    
    ll cnt = 0;
    f(0,n) {
        if( ans[i] == v[i] ) cnt++;
    }
    cout << cnt << "\n";
 return 0;
}


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


int prime[1000001]={};

int power(int x, unsigned int y, int p)  
{  
    int res = 1;     
  
    x = x % p; 
   
    if (x == 0) return 0; 
  
    while (y > 0)  
    {  
         
        if (y & 1)  
            res = (res*x) % p;  
  
        
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
}  

void pr()
{
  prime[1]=0;

 for(int i=2;i*i<1000001;i++)
  if(prime[i]==0)
  for(int j=i*i;j<1000001;j+=i)
  prime[j]=1;

}

int countSetBits( int n) 
{ 
     int count = 0; 
    while (n) { 
        count += n & 1; 
        n >>= 1; 
    } 
    return count; 
} 
  

bool fun(long a)
{
  if(a<10)
    return true;

  vector<int> arr;

  while(a>0)
{
   arr.push_back(a%10);
    a/=10;
}

  for(int i=0;i<arr.size()-1;i++)
 {
     if(abs(arr[i+1]-arr[i])>1)
      return false;
 }

  return true;
}




int main()
{
   //pr();
  int t;
   //cin>>t;
   t=1;

   vector<long> arr={1,2,3,4,5,6,7,8,9};

   int p=0;

   while(arr.size()<100000)
 {
    int l=arr.size();

   for(int i=p;i<l;i++)
 {
    if(arr.size()>=100000)
     break;

    long g= arr[i];
     int x= g%10;

    if(x-1>=0)
    arr.push_back(g*10+(x-1));

    arr.push_back(g*10+(x));

    if(x+1<10)
    arr.push_back(g*10+(x+1));
 }

    p=l;
 }
       


  //for(int i=0;i<100;i++)
  // cout<<arr[i]<<" ";

  // cout<<endl;





  while(t--)
{
    int n;

   // cout<<"input"<<endl;
     cin>>n;

     cout<<arr[n-1];
   
}




return 0;
}


Measured memory_bytes: 1464
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; i++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N,ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	int A, B; cin >> A >> B;
	for (int i = 1; i <= 1250; i++) {
		int x = i * 0.08;
		int y = i * 0.1;
		if (x == A && y == B) {
			cout << i << endl;
			return 0;
		}
	}

	cout << -1 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(){

  char passado[4],atual[4];
  int cont=0;

  for(int i=0;i<4;i++)
    scanf("%c",&passado[i]);

    for(int i=0;i<4;i++)
      scanf("%c",&atual[i]);

    for(int i=0;i<3;i++){
      
      if(passado[i]==atual[i])
        cont++;
    }

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


Measured memory_bytes: 128
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		// pw=new PrintWriter("C:\\Users\\Hp\\Desktop\\outt.txt");
		int n = sc.nextInt();
		int[] Arr = new int[n];
		for (int i = 0; i < n; i++)
			Arr[i] = sc.nextInt();
		long ans=Long.MAX_VALUE;
		for (int x = 0; x < 200; x++) {
			long sum=0;
			for (int i = 0; i < n; i++)
				sum+=(x-Arr[i])*(x-Arr[i]);
			ans=Math.min(ans, sum);
		}
		pw.print(ans);
		pw.close();
	}

	public static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException, IOException {
			return br.ready();
		}

	}
}

Measured memory_bytes: 22228
#include <stdio.h>
int main()
{
    int num;
    scanf("%d", &num);
    long long int arr[num],mul = 1;
    for (int i = 0; i < num; i++)
    {
        scanf("%lld", &arr[i]);
        if (arr[i] == 0)
        {
            printf("0\n");
            return 0;
        }
    }
    for (int i = 0; i < num; i++)
    {
        if (mul > 1000000000000000000/arr[i])
        {
            printf("-1\n");
            return 0;
        }
        mul *= arr[i];
    }
    printf("%lld\n", mul);
    return 0;
}


Measured memory_bytes: 2508
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
#define INF int(1e9)

template<class T,class U> ostream& operator<<(ostream& ost, const pair<T,U> &p) { ost << "(" << p.first << ", " << p.second << ")"; return ost; }
#define ostream_container { ost << "{"; for(const auto &t : v) { if (&t != &*v.begin()) ost << ", "; ost << t; } ost << "}"; return ost; }
template<class T> ostream& operator<<(ostream &ost, const vector<T> &v) ostream_container
template<class T> ostream& operator<<(ostream &ost, const set<T> &v) ostream_container
template<class T,class U> ostream& operator<<(ostream &ost, const map<T,U> &v) ostream_container

template<class H> void recursive_debug(string s, H h) {
    cerr << "\033[33m" << s << " = " << h << endl << "\033[m";
}
template<class H,class... T> void recursive_debug(string s, H h, T... t) {
    int comma = s.find(',');
    cerr << "\033[33m" << s.substr(0,comma) << " = " << h << ", ";
    recursive_debug(s.substr(comma+1), t...);
}
#define debug(...) recursive_debug(#__VA_ARGS__, __VA_ARGS__)


int main(void) {
    int l,r,d;
    int cnt = 0;
    cin >> l >> r >> d;
    for (int i = l; i <= r; i++) {
        if (i % d == 0) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int gcd(int x , int y){
  if(y>x){
    swap(x,y);
  }
  int z=x%y;
  if(z == 0){
    return(y);
  } else {
    return( gcd(y,z) );
  }
}

signed main(){
  int n , a[100005] , ans=0 , f[100005] , b[100005];
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    f[i]=a[i] , b[i]=a[i];
  }
  
  for(int i=2;i<=n;i++){
    f[i]=gcd(f[i],f[i-1]);
    b[n-i+1]=gcd(b[n-i+1],b[n-i+2]);
  }
  
  f[0]=b[2] , b[n+1]=f[n-1];
  
  for(int i=1;i<=n;i++){
    ans=max(ans , gcd(f[i-1],b[i+1]) );
  }
  
  cout<<ans<<endl;
  return(0);
}

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

int main(){
    int N;
    int S, test;
    int min, max;
    int ans = 0;

    cin >> N >> min >> max;

    for(int i=1; i<=N; i++){
        S = 0;
        test = i;
        while(test > 0){
            S += test % 10;
            test /= 10;
        }

        if(S >= min && S <= max) ans += i;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
long MOD=998244353;
long n,k,i,ans[2002],p2[2001]={1},C[4001][4001];
long f(long t)
{
	long p=0,ans=0;
	for(int i=1;i<=k&&t-i<=k&&i<t-i;i++)p++;
	for(long q=0;q<=p;q++)
	{
		long now=p2[q]*C[p][q]%MOD;
		long a=k-2*p+q-!(t%2),b=n-q;
		now=now*(b<0?0:C[a+b-1][b])%MOD;
		ans=(ans+now)%MOD;
	}
	return ans;
}
main()
{
	cin>>k>>n;
	for(p2[0]=i=1;i<=2000;i++)p2[i]=p2[i-1]*2%MOD;
	for(i=0;i<=4000;i++)C[i][0]=1;
	for(i=1;i<=4000;i++)for(long j=1;j<=i;j++)C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;
	for(i=1;i++<=k;)
	{
		ans[i]=f(i);
		i%2||(n--,ans[i]+=f(i),n++);
		cout<<ans[i]%MOD<<endl;
	}
	for(--i;--i>1;)cout<<ans[i]%MOD<<endl;
}


Measured memory_bytes: 123648
#include<iostream>
#include <climits>
#include<vector>
#include<list>
#include<numeric>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

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

	string S, T;
	cin >> S >> T;
	int n = S.size();
	bool yes = false;
	REP(i, n) {
		if (S == T) {
			yes = true;
			break;
		}
		else {
			char c = S[n - 1];
			S.pop_back();
			S.insert(S.begin(), c);
		}
	}
	if (yes) cout << "Yes\n";
	else cout << "No\n";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
    int n=1000010;
    vector<int>em(260,0);
    for(int i=0;i<250;i++){
        em[i]=i*(i+1)*(i+2)/6;
      //  clog<<em[i]<<endl;
    }
    vector<pair<int,int>>dp(1000010,mp(INF,INF));
    while(1){
        dp[0] = mp(0, 0);
        for (int i = 0; em[i] <= n; i++)
        {
            for (int j = 0; j + em[i] <= n; j++)
            {
                chmin(dp[j + em[i]].F, dp[j].F + 1);
                if (em[i] % 2 == 1)
                {
                    chmin(dp[j + em[i]].S, dp[j].S + 1);
                }
            }
        }
        cin>>n;
        if(n==0){
            break;
        }
        

        cout << dp[n].F<<" "<<dp[n].S << endl;
    }
    
   
}


Measured memory_bytes: 10512
let swap a i j =
  let temp = a.(i) in
  a.(i) <- a.(j);a.(j) <- temp;;

let rec find a x n =
  if a.(n) = x then n else find a x (n+1);;

let is_stable org c n =
  let rec loop = function
      i when i = n -> "Stable"
    | i ->
       if (snd c.(i)) = (snd c.(i-1)) then
         if find org c.(i) 0 > find org c.(i-1) 0 then loop (i+1)
         else "Not stable"
       else
         loop (i+1)
  in loop 1
;;

let partition a p r =
  let x = a.(r) and
      i = ref (p-1) in
  for j = p to (r-1) do
    if (snd a.(j)) <= (snd x) then
      begin
        i := (!i) + 1;
        swap a (!i) j;
      end;
  done;
  swap a ((!i)+1) r;
  (!i) + 1
;;

let rec quick_sort a p r =
  if p < r then
    let q = partition a p r in
    quick_sort a p (q-1);
    quick_sort a (q+1) r
;;

let () =
  let n = read_int () in
  let a1 = Array.init n (fun x -> Scanf.scanf "%s %d\n" (fun y z-> (y,z))) in
  let a2 = Array.copy a1 in
  quick_sort a2 0 (n-1);
  print_endline (is_stable a1 a2 n);
  Array.iter (fun x -> Printf.printf "%s %d\n" (fst x) (snd x)) a2
;;

Measured memory_bytes: 10812
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main() {
    cin>>S>>T;
    N = S.size();
    M = T.size();
    rep(i,N+M){
        if(i%2) cout<<T[i/2];
        else cout<<S[i/2];
    }
    cout<<endl;
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int n, m;

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

  cin>>n>>m;
  priority_queue<int> q;
  for (int i=0; i<n; i++) {
    int x; cin>>x;
    q.push(x);
  }

  while (m--) {
    int x = q.top(); q.pop();
    x = x / 2;
    q.push(x);
  }

  ll tot = 0;
  while (!q.empty()) {
    tot += q.top();
    q.pop();
  }

  cout<<tot<<endl;
  

  return 0;
}


Measured memory_bytes: 892
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	fsc := NewFastScanner()
	_ = fsc.NextInt()
	K := fsc.NextInt()
	X := fsc.NextIntArray()
	res := 0
	for _, x := range X {
		res += IntMin(2*x, 2*(K-x))
	}
	fmt.Println(res)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}

func (s *FastScanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int H,N;
    cin >> H >> N;
    vector<int> A(N);
    vector<int> B(N);
    rep(i,N) cin >> A[i] >> B[i];
    vector<int> dp(H+1,1001001001);
    dp[0]=0;
    for(int i=0;i<N;i++){
       for(int j=0;j<H;j++){
           dp[min(j+A[i],H)] = min(dp[min(j+A[i],H)],dp[j]+B[i]);
       }
    }
    cout << dp[H] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
ll n;
vector<string> ans;
void dfs(string s,int k){
    if(s.size()==n){
        cout<<s<<endl;
        return ;
    }
    rep(j,k+1){
        char c = 'a' + j;
        dfs(s+c,(j==k)?(k+1):k);
    }
}

// void dfs(string s,char mx){
//     if(s.size()==n){
//         ans.pb(s);
//         return ;
//     }
//     for(char c='a';c<=mx;c++){
//         dfs(s+c,(c==mx)?(char)(mx+1):mx);
//     }
// }

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

cin>>n;
dfs("",0);


// system("pause");
return 0;
}

Measured memory_bytes: 1536