akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
    // clang-format on

#include <queue>
#include <tuple>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N, M, K, S;
    cin >> N >> M >> K >> S;
    ll P, Q;
    cin >> P >> Q;
    vector<int> C(K);
    REP(i, 0, K) {
        cin >> C[i];
        C[i]--;
    }
    vector<vector<int>> Graph(N);
    REP(i, 0, M) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        Graph[a].push_back(b);
        Graph[b].push_back(a);
    }
    vector<bool> zombie(N, false);
    {
        using T = tuple<int, int>;
        queue<T> q;
        REP(i, 0, K) {
            q.emplace(C[i], 0);
        }
        while (q.size()) {
            int to, cost;
            tie(to, cost) = q.front();
            q.pop();
            if (cost > S) continue;
            if (zombie[to]) continue;
            zombie[to] = true;
            REP(i, 0, Graph[to].size()) {
                int nxt = Graph[to][i];
                if (!zombie[nxt]) {
                    q.emplace(nxt, cost + 1);
                }
            }
        }
    }
    const ll inf = 1LL << 60;
    vector<ll> Cost(N, inf);
    {
        vector<bool> notuse(N, false);
        REP(i, 0, K) {
            notuse[C[i]] = true;
        }
        using T = tuple<ll, int>;
        Cost[0] = 0;
        priority_queue<T, vector<T>, greater<T>> pq;
        pq.emplace(0, 0);
        while (pq.size()) {
            ll cost;
            int to;
            tie(cost, to) = pq.top();
            pq.pop();
            if (Cost[to] < cost) continue;
            Cost[to] = cost;
            REP(i, 0, Graph[to].size()) {
                int nxt = Graph[to][i];
                if (notuse[nxt]) continue;
                ll ncost = P;
                if (zombie[nxt]) {
                    ncost = Q;
                }
                if (nxt == N - 1) {
                    ncost = 0;
                }
                if (Cost[nxt] > cost + ncost) {
                    Cost[nxt] = cost + ncost;
                    pq.emplace(Cost[nxt], nxt);
                }
            }
        }
    }
    cout << Cost[N - 1] << endl;
    return 0;
}



Measured memory_bytes: 10340
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846;
typedef long long  ll;
int main()
{
int a,b;
cin>>a>>b;
int s=1;
int c=0;
while(b>s)
{
    s+=(a-1);
    c++;
}
cout<<c;
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <vector>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define INF 10000000
#define PI 3.141592653589793
using ll = long long ;
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}
template< int id > struct CompTupleBy
{
  template<class T> 
  bool operator()( const T& a, const T& b ) const {
    return std::get<id>(a) < std::get<id>(b);
  }
};


using namespace std;
using Graph = vector< vector<int> > ;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int k;
    cin >> k;
    string s;
    cin >> s;
    if (s.length() <= k){
        cout << s << endl;
    }else{
        cout << s.substr(0,k) << "..." << endl;
    }

        
}

Measured memory_bytes: 3644
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(int i=0;i<n;i++)
#define Rip(i,n) for(int i=1;i<n;i++)
#define ll long long
#define ld long double
#define pi 3.1415926535897932384626433832795028841971693993
#define mod 1000000007
#define MOD mod
#define sec setprecision
#define RAND_MAX 0x7fffffff
using namespace std;
ll gcd(ll a, ll b) {
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
int ketasuu(ll h) {
	if (h < 0)return(-(ketasuu(-h)));
	else if (h < 10)return(1);
	else return(1 + ketasuu(h / 10));
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
vector<ll> soinnsuubunnkai(ll n) {
	vector<ll>a;
	while (n % 2 == 0) {
		a.push_back(2);
		n /= 2;
	}
	ll f = 3;
	while (f * f <= n) {
		if (n % f == 0) {
			a.push_back(f);
			n /= f;
		}
		else f += 2;
	}
	if (n != 1)
		a.push_back(n);
	return(a);
}
// 二項係数計算
long long com(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
ll pow(ll a, ll b) {
	a = a % mod;
	if (b == 0)return(1);
	else if (b % 2 == 0)return(pow((a * a)%mod, b / 2));
	else return(a * (pow(a, b - 1)));
}
void solve() {
	
}
int main() {
	int n, k; string s;
	cin >> n >> k >> s;
	if (s[k - 1] == 'A')s[k - 1] = 'a';
	if (s[k - 1] == 'B')s[k - 1] = 'b';
	if (s[k - 1] == 'C')s[k - 1] = 'c';
	cout << s << endl;
}

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

min_ = min(list)
max_ = max(list)

total = []
if min_ == max_:
  print(0)
else:
  for i in range(min_, max_):
    length = 0
    for j in range(n):
  	  length += (list[j] - i)**2
    total.append(length)
  print(min(total))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>

using namespace std;

struct edge
{
	char to;
	char city;
	int next;
};
vector< vector<edge> > Map(6);

void setup()
{
	edge e;
	e.to = '0';
	e.city = 'X';
	e.next = 1;
	Map[0].push_back(e);

	e.to = '1';
	e.city = 'Y';
	e.next = 2;	
	Map[0].push_back(e);

	e.to = '1';
	e.city = 'Z';
	e.next = 3;
	Map[1].push_back(e);

	e.to = '0';
	e.city = 'X';
	e.next = 1;
	Map[2].push_back(e);

	e.to = '0';
	e.city = 'W';
	e.next = 4;
	Map[3].push_back(e);

	e.to = '1';
	e.city = 'B';
	e.next = 5;
	Map[3].push_back(e);

	e.to = '0';
	e.city = 'B';
	e.next = 5;
	Map[4].push_back(e);

	e.to = '1';
	e.city = 'Y';
	e.next = 2;
	Map[4].push_back(e);

	e.to = '0';
	e.city = 'Y';
	e.next = 2;
	Map[5].push_back(e);

	e.to = '1';
	e.city = 'X';
	e.next = 1;
	Map[5].push_back(e);
}

void solve()
{
	setup();
	string s;
	while(cin >> s)
	{
		if(s == "#")
		{
			break;
		}
		int pos = 0;
		char city = 'A';
		bool flag = false;
		for(int i = 0; i < s.size(); ++i)
		{
			flag = false;
			for(int j = 0; j < Map[pos].size(); ++j)
			{
				if(Map[pos][j].to == s[i])
				{
					city = Map[pos][j].city;
					pos = Map[pos][j].next;
					flag = true;
					break;
				}
			}
			if(!flag)
			{
				cout << "No" << endl;
				goto END;
			}
		}
		if(city == 'B')
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
END:
		;
	}
}

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

Measured memory_bytes: 1200
x,y=input().split()
x=int(x)
y=int(y)
f=0
for i in range(x+1):
  for j in range(x+1):
    if((((2*i)+(4*j))==y)and((i+j)==x)):
      f=1;
      break
if(f==1):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9136
#include <bits/stdc++.h>
using namespace std;
 
/* REPmacro */
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define REPR(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
 
/*alias*/
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define PB push_back
#define MP make_pair 
 
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
 
/*using*/
using ll = long long;
using ull = unsigned long long;
using unsi = unsigned;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using db = double;
using plex = complex<double>;
using vs = vector<string>;
 
/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
/* func */
int gcd(int a,int b){return b?gcd(b,a%b):a;}
 
/*struct*/
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;
 
/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const db EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
 
//#define int ll
//#define int long long
 
signed main()
{
  int options; cin >> options;
  
  int t; cin >> t;
  int a; cin >> a; a *= 1000;
  int h;
  int ave;
  
  vi H(0);
  REP(i, options){
    cin >> h;
    H.PB(h);
  }
  
  vi Ave(0);
  REP(i, options){
    ave = t*1000-H[i]*6;
    Ave.PB(ave);
  }
  
   REP(i, options)
    if(Ave[i] == a){
      cout << i+1;
       return 0;
    }
  
  REP(i, options){
   if(Ave[i] < a)
     Ave[i] = a - Ave[i];
   else if(Ave[i] > a)
     Ave[i] = Ave[i] - a;
  }
  
  REP(i, options)
    if(Ave[i] < 0)
      Ave[i] *= -1;
  
  int min = *min_element(ALL(Ave));
  
  REP(i, options)
   if(min == Ave[i]){
    cout << i+1;
     return 0;
  }
 
  return 0;
}

Measured memory_bytes: 256
import numpy as np

A, B, C = map(int, input().split())

ans = 0
T = A + B + C
s = np.array([A, B, C])
while all(s % 2 == 0):
    if A == B == C:
        print(-1)
        exit(0)
    s = (T - s) // 2
    ans += 1

print(ans)


Measured memory_bytes: 15148
n,m=map(int,input().split())
l=sorted([list(map(int,input().split())) for i in range(n)])
p=0
for i in range(n):
    a,b=l[i]
    if b<m:
        m-=b
        p+=a*b
    else:
        p+=a*m
        break
print(p)

Measured memory_bytes: 28656
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <cstring>
#include <iomanip>
using namespace std;
typedef long long ll;



int main() {
    vector<int> A(3);
    for(int &a:A) cin >> a;
    sort(A.begin(), A.end());
    cout << 10 * A[2] + A[1] + A[0] << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
 
namespace aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            int count;
            var value = new int[7];
            while((count = int.Parse(Console.ReadLine())) != 0) {
                foreach(var i in Enumerable.Range(0, count)) {
                    int age = int.Parse(Console.ReadLine());
                    if(age >= 70) {
                        age = 60;
                    }
                    ++value[age / 10];
                }
                for(int i = 0; i < value.Length; ++i) {
                    Console.WriteLine(value[i]);
                    value[i] = 0;
                }
            }
        }
    }
}

Measured memory_bytes: 5940
#include <iostream>

using namespace std;

typedef long long ll;

int main(int argc, char *argv[])
{
	int A, B;

	cin >> A >> B;

	for (int i = 1; i <= 1001; i++) {
		double x, y;
		x = i * 0.08;
		y = i * 0.1;
		int m, n;
		m = int(x);
		n = int(y);
		if (m == A && n == B) {
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<map>
#include<queue>

using namespace std;

class wormcheck{
    public:
    string Worm;
    int Val;
    wormcheck(string W,int V){
        Worm=W;
        Val=V;
    }
};

int main(){
    string worm;
    while(cin>>worm){
        if(worm=="0")break;
        queue<wormcheck> que;
        que.push(wormcheck(worm,0));
        map<string,int> visit;
        while(1){
            if(que.empty()){cout<<"NA"<<endl;break;}
            wormcheck w = que.front();
            que.pop();
            if(visit[w.Worm]==1)continue;
            visit[w.Worm]=1;
            for(int i=1;i<w.Worm.size();i++){
                if(w.Worm[i]!=w.Worm[i-1]){
                    goto Skip;
                }
            }
            //printf("%s %d",w.Worm,w.Val);
            cout<<w.Val<<endl;
            break;
            Skip:;
            string subWorm = w.Worm;
            for(int i=1;i<w.Worm.size();i++){
                if(subWorm[i]!=subWorm[i-1]){
                    if(subWorm[i]!='b'&&subWorm[i-1]!='b'){
                        subWorm[i]='b';
                        subWorm[i-1]='b';
                    }
                    else if(subWorm[i]!='g'&&subWorm[i-1]!='g'){
                        subWorm[i]='g';
                        subWorm[i-1]='g';
                    }
                    else if(subWorm[i]!='r'&&subWorm[i-1]!='r'){
                        subWorm[i]='r';
                        subWorm[i-1]='r';
                    }
                    que.push(wormcheck(subWorm,w.Val+1));
                    subWorm=w.Worm;
                }
            }
        }

    }
    return 0;
}

Measured memory_bytes: 3200
import sys
N=int(input())
# N=50

p = []
for n in range(N):
    x,y = map(int,input().split())
    # x,y = n,n
    p.append( (x,y) )

if N == 1:
    print(1)
    exit()

p = list(sorted(p))

diffs = {}
for i,pi in enumerate(p):
    for j,pj in enumerate(p):
        if i < j:
            diff = (pi[0]-pj[0], pi[1]-pj[1])
            if diff not in diffs:
                diffs[diff] = 0
            diffs[diff] += 1

mxdiff = 0
for k in diffs:
    mxdiff = max(mxdiff, diffs[k])
print(N-mxdiff)




Measured memory_bytes: 39792
#define _CRT_SECURE_NO_WARNINGS 1

#include <set>
#include <map>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <string>
#include <iomanip>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define rep(i,a,b) for(int i = (a) ; i <= (b) ; i++)
#define per(i,a,b) for(int i = (a) ; i >= (b) ; i--)
#define mem(a) memset(a,0,sizeof(a))
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const int INF = 1e9;
const LL mod = 1e9 + 7;
const int maxn = 5e5 + 7;

int main() {
	int k;
	sd(k);
	if(k % 2 == 0 || k % 5 == 0) puts("-1");
	else {
		int res = 7;
		for(int i = 1 ; ; i++) {
			if(res % k == 0) {
				pd(i);
				break;
			}
			res = (res * 10 + 7) % k;
		}
	}
	return 0;
}

Measured memory_bytes: 3804
import java.util.Scanner;

//Receipt
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int t = sc.nextInt();
			if(t==0)break;
			int s = 0;
			for(int i=0;i<9;i++)s+=sc.nextInt();
			System.out.println(t-s);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include "bits/stdc++.h"

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
#define fir first
#define sec second

const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

int n;
int a[200010];

int m;

void solve() {
	int b_sum = 0;
	vector<int> b(n + 1, 0);
	for (int i = n; i >= 1; i--) {
		b_sum = 0;
		for (int j = i; j <= n; j += i) {
			b_sum += b[j];
		}
		if (b_sum % 2 != a[i]) b[i] = 1;
	}

	for (int i = 1; i <= n; i++) if (b[i] == 1) m++;

	cout<< m <<endl;
	if (m > 0) {
		for (int i = 1; i <= n; i++) {
			if (b[i]) cout<< i << " ";
		}cout<<endl;
	}

	return;
}

int main(void){
	cin>>n;
	for (int i = 1; i <= n; i++) cin>>a[i];

	solve();
	
	return 0;
}

Measured memory_bytes: 2432
#include <stdio.h>

int main(void)
{
    int a,b,c = 0;
    scanf("%d%d",&a,&b);
    if (a + b >= 24) {
        c = a + b - 24;
    }else{
        c = a + b;
    }
    printf("%d\n",c);
    return 0;
}


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

class Dice {
public:
  int u;
  int r;
  int l;
  int d;
  int b;
  int f;
  void S(void) {
    int temp;
    temp = u; u = b; b = d; d = f; f = temp;
  }
  void N(void) {
    int temp;
    temp = u; u = f; f = d; d = b; b = temp;
  }
  void E(void) {
    int temp;
    temp = u; u = l; l = d; d = r; r = temp;
  }
  void W(void) {
    int temp;
    temp = u; u = r; r = d; d = l; l = temp;
  }
  void T(void) {
    int temp;
    temp = f; f = r; r = b; b = l; l = temp;
  }
};

int main() {

  Dice dice;
  std::string str;
  int m = 0;
  int N;
  int u, f;
  
  std::cin >> dice.u;
  std::cin >> dice.f;
  std::cin >> dice.r;
  std::cin >> dice.l;
  std::cin >> dice.b;
  std::cin >> dice.d;


  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::cin >> u >> f;
    while( dice.u != u) {
      if( m == 0 ) {
	dice.N();
      }
      else {
	dice.E();
      }
      m = 1 - m;
    }
    while( dice.f != f ) {
      dice.T();
    }
    std::cout << dice.r << std::endl;
  }
      
  
  return 0;
}

Measured memory_bytes: 1160
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
 
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;


int main()
{
    ll N, M;
    cin >> N >> M;
    vector<ll> L(M);
    vector<ll> R(M);
    ll l = 1;
    ll r = N;
    rep(i, M) {
        ll L, R;
        cin >> L >> R;
        l = max(L,l);
        r = min(R,r);
    }
    if (r - l >= 0) print(r - l + 1);
    else print(0);
    
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

int math,greedy,gem,dp,graph,other;

void solve(){
    while(cin>>math>>greedy>>gem>>dp>>graph>>other&&!(math==0&&greedy==0&&gem==0&&dp==0&&graph==0&&other==0)){
        int n1=math+dp;
        int n2=greedy+graph;
        int n3=gem+other;
        int maxSum=0;
        for(int i = 0; i < 3; i++){
            n1=math+dp;
            n2=greedy+graph;
            n3=gem+other;
            int sum=0;
            if(n1>=i&&n2>=i&&n3>=i){
                n1-=i;n2-=i;n3-=i;
                sum+=(n1/3)+(n2/3)+(n3/3);
                maxSum=max(maxSum,sum+i);
            }
            else
                continue;
        }
        cout<<maxSum<<endl;
    }
}

int main(){

    solve();

    return 0;
}

Measured memory_bytes: 868
def DistinctOrNot(A_list):
  A_dict = {}
  for A in A_list:
    if A in A_dict:
      return 'NO'
    else:
      A_dict[A] = 1
  return 'YES'

N = int(input())
A_list = list(map(int, input().split()))
print (DistinctOrNot(A_list))

Measured memory_bytes: 33612
a,b,c=map(int,input().split())
d=a%b
if d==0:
    if c==0:
        A=True
    else:
        A=False
else:
    for i in range(1,max(a,b)):
        if (i*d)%b==c:
            A=True
            break
        else:
            A=False
if A:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;

int main() {
	int n, i;
	double x[4], y[4], a[2], b[2], c[2], r;
	cin >> n;
	for (i = 0;i < n;i++) {
		cin >> x[1] >> y[1] >> x[2] >> y[2] >> x[3] >> y[3];

		a[0] = 2.0*(x[2] - x[1]);
		b[0] = 2.0*(y[2] - y[1]);
		c[0] = x[1] * x[1] - x[2] * x[2] + y[1] * y[1] - y[2] * y[2];
		a[1] = 2.0 * (x[3] - x[1]);
		b[1] = 2.0*(y[3] - y[1]);
		c[1] = x[1] * x[1] - x[3] * x[3] + y[1] * y[1] - y[3] * y[3];

		x[0] = (b[0] * c[1] - b[1] * c[0]) / (a[0] * b[1] - a[1] * b[0]);
		y[0] = (c[0] * a[1] - c[1] * a[0]) / (a[0] * b[1] - a[1] * b[0]);

		r = sqrt((x[1] - x[0])*(x[1] - x[0]) + (y[1] - y[0])*(y[1] - y[0]));
		printf("%.3f %.3f %.3f\n", x[0], y[0], r);
	}
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
using namespace std;
 
int main(){
string s;
cin >> s;
int ans = 0;
int zero = 0;
int one = 0;
for(int i=0;i<s.size();i++){
  if(s[i] == '0')zero++;
  if(s[i] == '1')one++;
}
cout <<2 * min(one,zero) << endl;
return 0;
}

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

class solution {
   private:
    int N;
    int MAX;
    int weight[40] = {}, weightSum[40] = {};
    bool adj[40][40] = {};

    void dfs(vector<bool> &bits, int sum, int index) {
        if (index == N) {
            if (sum > MAX) {
                MAX = sum;
            }
            return;
        }
        if (sum + weightSum[index] < MAX) {
            return;
        }
        dfs(bits, sum, index + 1);
        for (int i = 0; i < index; i++) {
            if (bits[i] & adj[i][index]) {
                return;
            }
        }
        bits[index] = true;
        dfs(bits, sum + weight[index], index + 1);
        bits[index] = false;
        return;
    }

   public:
    int solve() {
        MAX = weight[0];
        vector<bool> bits(N, false);
        bits[0] = true;
        dfs(bits, weight[0], 1);
        return MAX;
    }

    void getInput() {
        int C[N];
        string A[N], D[N][N];
        map<string, int> m;
        for (int i = 0; i < N; i++) {
            cin >> A[i] >> weight[i] >> C[i];
            for (int j = 0; j < C[i]; j++) {
                cin >> D[i][j];
            }
            m[A[i]] = i;
        }
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < C[i]; j++) {
                adj[m[A[i]]][m[D[i][j]]] = true;
            }
        }
        weightSum[N - 1] = weight[N - 1];
        for (int i = N - 2; 0 <= i; i--) {
            weightSum[i] = weight[i] + weightSum[i + 1];
        }
    }

    solution(int x) : N(x){};
};

int main() {
    int N;
    while (true) {
        cin >> N;
        if (N == 0) break;
        solution s(N);
        s.getInput();
        cout << s.solve() << endl;
    }
    return 0;
}



Measured memory_bytes: 3288
#include<iostream>
#include<cmath>
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
typedef long long int ll;
const ll maxn=1e9+5;
int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll m1,m2,m3,m4;
    m1=a*c;
    m2=b*d;
    m3=a*d;
    m4=c*b;
    ll m5=max(m1,m2);
    ll m6=max(m3,m4);
    ll ans=max(m5,m6);
        cout<<ans<<"\n";
    cerr<<"\nTime elapsed:"<< 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}


Measured memory_bytes: 3628
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
int n;
int visited[201],there[201];
vector<vector<int>> vt;
pair<int, int> a[110];
pair<int, int> b[110];
int dfs(int here)
{
	if (visited[here])return 0;
	visited[here] = 1;
	for (int i = 0; i < vt[here].size(); i++)
	{
		int next = vt[here][i];
		if (!there[next] || dfs(there[next])) {
			there[next] = here;
			return 1;
		}
	}
	return 0;
}
int main()
{
	scanf("%d", &n);
	vt.resize(n+101);
	for (int i = 1; i <= n; i++)
		scanf("%d %d", &a[i].first, &a[i].second);
	for (int i = 1; i <= n; i++)
		scanf("%d %d", &b[i].first, &b[i].second);
	for (int i = 1; i <= n; i++)
	{
		for (int y = 1; y <= n; y++)
		{
			if (a[i].first < b[y].first&&a[i].second < b[y].second)
				vt[i].push_back(y+100);
		}
	}
	int dap = 0;
	for (int i = 1; i <= n; i++)
	{
		memset(visited, 0, sizeof(visited));
		dap += dfs(i);
	}
	printf("%d", dap);
}

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

using namespace std;

int main()
{
    long long a,b,k=1;

    cin>>a>>b;

    long long c=__gcd(a,b);

    for(long long i=2;i*i<=c;i++)
    {
        if(c%i==0) {
        
        k++;
        while(c%i==0) c/=i;
        }
    }

    if(c!=1) k++;

    cout<<k;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )
#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

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

	for ( int h, w; cin >> h >> w, h | w; )
	{
		VS board( h );
		FOR( line, board )
		{
			cin >> line;
		}

		map<string,int> counts;
		REP( i, 0, h )
		{
			REP( j, 0, w )
			{
				REP( dy, -1, 2 )
				{
					REP( dx, -1, 2 )
					{
						int y = i, x = j;
						string cur;
						VVI visited( h, VI( w ) );

						do
						{
							cur += board[y][x];
							counts[ cur ] ++;

							visited[y][x] = 1;
							( y += dy + h ) %= h;
							( x += dx + w ) %= w;
						}
						while ( !visited[y][x] );
					}
				}
			}
		}

		string res;
		FOR( it, counts )
		{
			if ( it.snd < 2 )
			{
				continue;
			}

			if ( res.size() < it.fst.size() )
			{
				res = it.fst;
			}
			else if ( res.size() == it.fst.size() )
			{
				res = min( res, it.fst );
			}
		}

		cout << ( 2 <= res.size() ? res : "0" ) << endl;
	}

	return 0;
}

Measured memory_bytes: 36052
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define double long double
#define pi 3.141592653589
using namespace std;
ll memo[55], cnt[55];
signed main() {
	ll a, b, ans = 0;
	cin >> a >> b;
	memo[0] = 1;
	for (int i = 1; i <= 50; i++)memo[i] = memo[i - 1] * 2;
	rep(i, 50)cnt[i] = 0;
	for (int i = 1; i <= 50; i++) {
		if (memo[i] <= b)cnt[i] = (b / (memo[i] * 2) * 2 + max((ll)0, b % (memo[i] * 2) - memo[i] + 1) - ((a - 1) / (memo[i] * 2) * 2 + max((ll)0, (a - 1) % (memo[i] * 2) - memo[i] + 1))) % 2;
		else break;
	}
	cnt[0] = ((b + 1) / 2 - a / 2) % 2;
	for (int i = 0; i <= 50; i++) {
		if (cnt[i])ans += memo[i];
	}
	cout << ans << endl;
	getchar(); getchar(); return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

bool isEqual(string S, string T){
  rep(i,S.length()) if(S[i] != '?' && S[i] != T[i]) return false;
  return true;
}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  string S,T;cin >> S >> T;
  per(i,S.length()+1-T.length()){
    if(isEqual(S.substr(i,T.length()), T)){
      rep(j,S.length()){
        if(j>=i && j<i+T.length()) S[j] = T[j-i];
        if(S[j] == '?') S[j] = 'a';
      }
      cout << S << endl;
      return 0;
    }
  }
  cout << "UNRESTORABLE" << endl;
  return 0;
}


Measured memory_bytes: 256
N,Q=map(int,input().split())
s=input()
#a=[]

l=[0]*(N)
for i in range(N-1):
    if s[i:i+2]=='AC':
        l[i+1]=l[i]+1
    else:
        l[i+1]=l[i]
#print(l)
ans=[]
for i in range(Q):
    first,last=map(int,input().split())
    ans.append(l[last-1]-l[first-1])

for i in ans:
    print(i)


Measured memory_bytes: 10324
#include <iostream>
#include <list>
#include <iterator>
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <set>
#include <stdio.h>
#include <cmath>
 
#define loop(i,n)   for(i=0;i<n;i++)
#define ll          long long
#define MAX         10000001
#define pi          acos(-1)

ll i,j,k,cnt,sum;
 
using namespace std;

bitset<MAX> prime;

void seive(){
	prime[0] = 1;
	prime[1] = 1;
	prime[2] = 0;

	for(i=4;i<MAX;i+=2){
		prime[i] = 1;
	}

	for(i=3;i*i<=MAX;i+=2){
		if(!prime[i]){
			for(j=i+i;j<MAX;j+=i){
				prime[j] = 1;
			}
		}
	}
}


//Code Starts Here//
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int r;
	cin>>r;

	cout<<r*2*pi<<endl;


	return 0;
}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define fir first
#define sec second
#define PB push_back
#define MP make_pair
using namespace std;
int SIZE=1e5;
int main(){
    int prime[SIZE+1];
    vector<int>V;
    memset(prime,1,sizeof(prime));
    prime[0]=prime[1]=0;
    REP(i,SIZE+1){
        if(prime[i]){
            for(int j=i*2;j<=SIZE;j+=i)prime[j]=0;
            V.PB(i);
        }
    }
    REP(i,SIZE){
        if(prime[i+1])prime[i+1]=i+1;
        else prime[i+1]=prime[i];
    }
    while(1){
        int m,a,b;
        cin>>m>>a>>b;
        if(m+a+b==0)break;
        pair<int,int>ans;
        ans=MP(-1,1);
        REP(i,V.size()){
            if(m/V[i]<=1)break;
            int p=V[i];
            int q[3];
            q[0]=p;q[1]=prime[m/V[i]];q[2]=prime[min(SIZE,p*b/a)];
            REP(j,3){
                if(q[j]>=p&&p*b>=q[j]*a&&q[j]*p<=m){
                    if(ans.fir*ans.sec<p*q[j])ans=MP(p,q[j]);
                }
            }
        }
        cout<<ans.fir<<" "<<ans.sec<<endl;
    }
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

/* http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_E&lang=jp
??¨????????¢
?????????????????? s1???s2 ?????¨????????¢?????¬??????????????\??????????????¢???????±???????????????????

??¨????????¢??¨????????\???????¨?????????????????????£?????????????????????????????\????????????????????¢??????????????????????????????????°??????°??§??????

?????\: ???????????????????????????????????\?????????
??????: ????????????????????????????????????????????????
??????: ????????????????????????????????\??????????????????????????????

*/

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	string s1, s2; cin >> s1 >> s2;
	vector<vector<ll>> dp(s1.length() + 1, vector<ll>(s2.length() + 1, INF));

	/* dp[i][j] := ?????????s1[0..(i-1)] ?????? ?????????s2[0..(j-1)]?????¨????????¢ ( ?????????0????????? ) */
	dp[0][0] = 0;
	for (int i = 1; i <= s1.length();i++) dp[i][0] = i;
	for (int j = 1; j <= s2.length(); j++) dp[0][j] = j;

	for (int i = 1; i <= s1.length(); i++) {
		for (int j = 1; j <= s2.length(); j++) {
			dp[i][j] = min({
				dp[i][j - 1] + 1,
				dp[i - 1][j] + 1,
				dp[i - 1][j - 1] + (s1[i - 1] != s2[j - 1])
			});
		}
	}

	/*for (int i = 0; i <= s1.length();i++) {
		for (int j = 0; j <= s2.length(); j++) {
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}*/
	cout << dp[s1.length()][s2.length()] << endl;
	return 0;
}

Measured memory_bytes: 10736
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	/**
	 * Main method.
	 */
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int a = s.nextInt();
		int b = s.nextInt();
		int c = s.nextInt();

		int[] ary = {a, b, c};
		
		int count = 0;
		
		Arrays.sort(ary);
		int max = calc_max(ary);
		int min = calc_min(ary);
		int median = ary[1];
		
		count += max - median;
		min += count;
		
		if ((max - min) % 2 == 0) {
			count += (max - min) / 2;
		} else {
			count += (max - min) / 2 + 2;
		}
		
		System.out.println(count);

	}

	public static int calc_max(int[] ary) {
		int max = ary[0];
		for (int i = 1; i < ary.length; i++) {
			max = Math.max(max, ary[i]);
		}
		return  max;
	}

	public static int calc_min(int[] ary) {
		int min = ary[0];
		for (int i = 1; i < ary.length; i++) {
			min = Math.min(min, ary[i]);
		}
		return  min;
	}
}


Measured memory_bytes: 23252
x = list(input())
n = [int(i) for i in x]

def func(m):
    x1 = m[0] + m[1] + m[2] + m[3]
    if x1 == 7:
        return ("{}+{}+{}+{}=7".format(m[0],m[1],m[2],m[3]))
    x2 = m[0] + m[1] + m[2] - m[3]
    if x2 == 7:
        return ("{}+{}+{}-{}=7".format(m[0],m[1],m[2],m[3]))
    x3 = m[0] + m[1] - m[2] - m[3]
    if x3 == 7:
        return ("{}+{}-{}-{}=7".format(m[0],m[1],m[2],m[3]))
    x4 = m[0] + m[1] - m[2] + m[3]
    if x4 == 7:
        return ("{}+{}-{}+{}=7".format(m[0],m[1],m[2],m[3]))
    x5 = m[0] - m[1] - m[2] + m[3]
    if x5 == 7:
        return ("{}-{}-{}+{}=7".format(m[0],m[1],m[2],m[3]))
    x6 = m[0] - m[1] - m[2] - m[3]
    if x6 == 7:
        return ("{}-{}-{}-{}=7".format(m[0],m[1],m[2],m[3]))
    x7 = m[0] - m[1] + m[2] - m[3]
    if x7 == 7:
        return ("{}-{}+{}-{}=7".format(m[0],m[1],m[2],m[3]))
    x8 = m[0] - m[1] + m[2] + m[3]
    if x8 == 7:
        return ("{}-{}+{}+{}=7".format(m[0],m[1],m[2],m[3]))

print(func(n))

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
  ll n,q,x;
  cin >> n >> q;
  ll a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  ll m=(n+1)/2;
  ll sum[m];
  sum[m-1]=0;
  for(int i=n-1;i>=0;i-=2) sum[m-1]+=a[i];
  for(int i=m-2;i>=0;i--){
    sum[i]=sum[i+1]-a[n-1-2*(m-1-i)]+a[n-1-(m-1-i)];
  }
  ll dis[m+1];
  dis[0]=-1e10,dis[m]=1e10;
  for(int i=m-1;i>=1;i--){
    dis[i]=(a[n-1-(m-i)*2]+a[n-1-(m-i)])/2+1;
  }
  for(int i=0;i<q;i++){
    cin >> x;
    ll p=upper_bound(dis,dis+m+1,x)-dis;
    cout << sum[p-1] << endl;
  }
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int N, C, K, ans = 0;
  cin >> N >> C >> K;

  std::vector<int> t(N);
  for (int i = 0; i < N; ++i) cin >> t[i];
  sort(t.begin(), t.end());

  int num = 0, time = -1;
  for (int i = 0; i < N;  ++i) {
    if (time == -1) time = t[i];

    if (t[i] - time > K || num >= C) {
      ans++;
      time = t[i];
      num = 1;
    } else {
      num++;
    }
  }

  cout << ans + 1 << endl;

  return 0;
}


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

int main() {
    int K = 0; int N = 0;
    cin >> N;
    string S;
    cin >> S;
    cin >> K;

    int s_size = N;

    char s = S[K-1];

    for(int i = 0; i < s_size; i++) {
        if(S[i] != s) S[i] = '*';
    }

    cout << S << endl;
}


Measured memory_bytes: 256
while True:
    n,x = map(int, raw_input().split())
    if n == 0 and x == 0: break
    c = 0
    for i in range(1, min(n+1,x/3)):
        for j in range(i+1, min(n+1,x/2)):
            for k in range(j+1, n+1):
                ijk = i + j + k
                if ijk == x:
                    c += 1
                    break
                elif ijk > x: break
    print c    

Measured memory_bytes: 4228
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 

vector<string> rotate(string s)
{
  set<char> se;
  for(int i=0;i<s.size();i++) se.insert(s[i]);
  int n = se.size();
  vector<string> v;
  for(int i=0;i<=n;i++)
  {
    v.pu(s+(char)('a'+i));
  }
  return v;
}

int main()
{
  __;
  set<string> se;
  int n;
  cin >> n;
  se.insert("a");
  for(int i=2;i<=n;i++)
  {
    set<string> temp;
    for(auto it : se)
    {
      string s = it;
      // temp.insert(s);
      vector<string> v = rotate(s);
      for(auto it : v) temp.insert(it);
    } 
    swap(se,temp);
  }
  for(auto it : se) cout << it << endl;
  return 0;
}


Measured memory_bytes: 16512
A, B  = list(input().split())                                                                                                                                                                                                                 
dic = {v: i+10 for i, v in enumerate(["A","B","C","D","E","F"])}
if dic[A] == dic[B]:
    print("=")
elif dic[A] > dic[B]:
    print(">")
else:
    print("<")

Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
	int a[100],b[100],i,j,wk,x,y;
	for(i=0;i<10;i++){
		scanf("%d",&a[i]);
	}
	for(i=0;i<10;i++){
		scanf("%d",&b[i]);
	}
	for(i=0;i<9;i++){
		for(j=i+1;j<10;j++){
			if(a[i]<a[j]){
				wk=a[i];
				a[i]=a[j];
				a[j]=wk;
			}
		}
	}
//	printf("%d %d %d\n",a[0],a[1],a[2]);
	for(i=0;i<9;i++){
		for(j=i+1;j<10;j++){
			if(b[i]<b[j]){
				wk=b[i];
				b[i]=b[j];
				b[j]=wk;
			}
		}
	}
//	printf("%d %d %d\n",b[0],b[1],b[2]);			
	x=a[0]+a[1]+a[2];
	y=b[0]+b[1]+b[2];
	printf("%d %d\n",x,y);
	return 0;
}

Measured memory_bytes: 1808
n, m = map(int, input().split( ))
x = list(map(int, input().split( )))
y = list(map(int, input().split( )))

mod = 10**9 +7

W = 0
for i in  range(n-1):
    W += (x[i+1]-x[i]) * (i+1) *(n-i-1)
    W %= mod

H = 0
for i in range(m-1):
    H += (y[i+1]-y[i]) * (i+1) *(m-i-1)
    H %= mod

ans = H * W % mod 

print(ans)

Measured memory_bytes: 83172
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000
 
int main (){
 unsigned short *A,*B;
  
 int C[VMAX+1];
 int n,i,j;
 scanf("%d",&n);
  
 A=malloc(sizeof(short)*n+1);
 B=malloc(sizeof(short)*n+1);
  
 for(i=0;i<=VMAX;i++) C[i]=0;
  
 for(i=0;i<n;i++){
  scanf("%hu",&A[i+1]);
  C[A[i+1]]++;
  }
   
  
 for(i=1;i<=VMAX;i++) C[i]=C[i]+C[i-1];
  
 for(j=1;j<=n;j++){
  B[C[A[j]]]=A[j];
  C[A[j]]--;
  }
  
 for(i=1;i<=n;i++){
  if(i>1)printf(" ");
  printf("%d",B[i]);
  }
  printf("\n");
   
  return 0;
   
  }


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

using namespace std;

typedef int in;
#define int long long

in main(){
    int n,a[105],mn = INT_MAX,mx = INT_MIN;
    cin >> n;
    for(int i = 0 ; i < n ; i ++){
        cin >> a[i];
        mx = max(mx,a[i]);
        mn = min(mn,a[i]);
    }
    int ans = INT_MAX;
    for(int i = mn ; i <= mx ; i ++){
        int sm = 0;
        for(int j = 0 ; j < n ; j ++){
            sm += (a[j] - i) * (a[j] - i);
        }
        ans = min(sm,ans);
    }
    cout << ans << endl;
    return 0;
}


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

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

	const int limit = 10000;

	for(int n, a, b, c, x; cin >> n >> a >> b >> c >> x, n;) {
		int time = -1;
		vector<int> y(n);
		for(int i = 0; i < n; ++i)
			cin >> y[i];

		for(int i = 0; i < n; ++i) {
			++time;
			while(x != y[i]) {
				if(++time > limit) {
					time = -1;
					goto finish;
				}

				x = (a * x + b) % c;
			}

			x = (a * x + b) % c;
		}

	finish:;

		cout << time << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1200
def dfs path,n,v,used,cm,w
  q = [v]
  used[v] = true
  while q.size!=0
    now = q.pop
    cm[now] = w
    path[now].each{|ne|
      if !used[ne]
        q << ne
        used[ne] = true
      end
    }
  end
end



n,k,l = gets.split.map &:to_i
pk = n.times.map{[]}
pl = n.times.map{[]}
k.times{
  x,y = gets.split.map &:to_i
  pk[x-1] << y-1
  pk[y-1] << x-1
}
l.times{
  x,y = gets.split.map &:to_i
  pl[x-1] << y-1
  pl[y-1] << x-1
}

cmk = [0]*n
cml = [0]*n

used = [false]*n
w = 0
n.times{|i|
  if !used[i]
    dfs(pk,n,i,used,cmk,w)
    w+=1
  end
}

used = [false]*n
w = 0
n.times{|i|
  if !used[i]
    dfs(pl,n,i,used,cml,w)
    w+=1
  end
}

h = Hash.new(0)
n.times{|i|
  h[(cmk[i]<<30)+cml[i]]+=1
}

ans = n.times.map{|i| h[(cmk[i]<<30)+cml[i]]}

puts ans*' '

Measured memory_bytes: 64508
from sys import stdin
from copy import deepcopy
input = stdin.readline

N = int(input())
A = list(input().split())

B = deepcopy(A)
S = deepcopy(A)


def p(N):
    for i in range(len(N)):
        if i == len(N) - 1:
            print(N[i])
        else:
            print(N[i], end=" ")


def bubblesort(n):
    for i in range(N):
        for j in range(N - 1, i, -1):
            if B[j][1] < B[j - 1][1]:
                B[j], B[j - 1] = B[j - 1], B[j]

    p(B)
    print("Stable")


def sellectionsort(n):
    for i in range(N):
        m = i
        for j in range(i + 1, N):
            if S[j][1] < S[m][1]:
                m = j
        S[m], S[i] = S[i], S[m]

    p(S)

    flag = True
    for i in range(N):
        if B[i] != S[i]:
            flag = False

    if flag:
        print("Stable")
    else:
        print("Not stable")


bubblesort(N)
sellectionsort(N)



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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }

const int MAX_N = 200000;
int n;
vi g[MAX_N];
ll addition[MAX_N];
ll score[MAX_N];

void dfs(int u, ll total = 0, int p = -1) {
  total += addition[u];

  score[u] = total;

  for (int v : g[u]) {
    if (v == p) continue;
    dfs(v,total,u);
  }
}

int main()
{
  int q;
  cin >> n >> q;
  forn(i,n-1) {
    int a,b; cin >> a >> b;
    a--,b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  while (q--) {
    int p,x; cin >> p >> x;
    addition[p-1] += x;
  }

  dfs(0,0);

  forn(i,n)
    cout << score[i] << " ";
  cout << endl;

  return 0;
}


Measured memory_bytes: 25600
N = int(input())
A_N=list(map(int, input().split()))
c_sum = 0
for a_i in A_N:
    c = 0
    while True:
        if a_i %2 == 0:
            a_i /= 2
            c += 1
        else:
            break
    c_sum += c
print(c_sum)

Measured memory_bytes: 4148
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FILL(a, x) memset(a, x, sizeof(a))

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)

int main() {
	string str;
	cin >> str;
	int n = str.length();
	int x0=0, x1=0;
	REP(i, n) {
		if (str[i] == ('0' + i % 2)) {
			x1++;
		}
		else {
			x0++;
		}
	}
	cout << min(x0, x1) << endl;
	return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
 
int main(void) {
  char name[12];
  unsigned long long id;
  scanf("%llu", &id);
  int i;
  int tmp;
  int len=0;
  for(i=0; id > 0; i++) {
    tmp = id % 26;
    if(tmp == 0) {
      name[i] = 'z';
    }
    else {
      name[i] = (char)(tmp - 1 + 'a');
    }
    id = id / 26;
    len++;
    if(tmp == 0) {
      id--;
    }
  }
  for(i=len-1; i >= 0; i--) {
    printf("%c", name[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 1644