akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

bool dp[90][90][10000];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h,w;
	cin>>h>>w;
	vector<vector<int>> a(h,vector<int>(w)),b(h,vector<int>(w));
	rep(i,h)rep(j,w) cin>>a[i][j];
	rep(i,h)rep(j,w){
		cin>>b[i][j];
		a[i][j]=abs(a[i][j]-b[i][j]);
	}
	rep(i,90)rep(j,90)rep(k,10000) dp[i][j][k]=false;
	dp[0][0][a[0][0]]=true;
	vector<int> dx={1,0},dy={0,1};
	rep(i,h)rep(j,w){
		rep(k,10000){
			if(dp[i][j][k]){
				rep(l,2){
					int nx=i+dx[l],ny=j+dy[l];
					if(0<=nx && nx<=h-1 && 0<=ny && ny<=w-1){
						dp[nx][ny][k+a[nx][ny]]=true;
						dp[nx][ny][abs(k-a[nx][ny])]=true;
					}
				}
			}
		}
	}
	rep(k,10000){
		if(dp[h-1][w-1][k]){
			cout<<k<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 79360
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int n, m;
vector<vector<int>> graph;
int ans = 0;

void dfs(int v, int p, int seen = 0) {
    bool is_complete = true;
    
    if ((seen & (1 << v)) != 0) {
        return;
    }
    
    seen |= (1 << v);
    
    rep(i, n) {
        if ((seen & (1 << i)) == 0) {
            is_complete = false;
            break;
        }
    }
    
    if (is_complete) {
        ans++;
        return;
    }
    
    rep(i, sz(graph[v])) {
        if (graph[v][i] == p) {
            continue;
        }
        
        dfs(graph[v][i], v, seen);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> n >> m;
    graph.resize(n);
    
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    
    dfs(0, -1, 0);
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

lint lcm(lint a, lint b) {
    return (a / gcd(a, b)) * b;
}

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int h, w;
    cin >> h >> w;
    vector<string> c(h);
    REP(i, h){
        cin >> c[i];
    }
    char ans[2*h][w];
    REP(i, 2*h){
        REP(j, w){
            ans[i][j] = c[i/2][j];
        }
    }
    REP(i, 2*h){
        REP(j, w){
            cout << ans[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;

const string YES = "YES";
const string NO = "NO";

void solve(long long N, std::vector<long long> A){
    set<ll> r;
    REP(i, N) r.insert(A[i]);
    if(r.size() == N) cout<<YES<<endl;
    else cout<<NO<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,ct=0,d,i,j,k;
    cin>>a;
    vector<long long>vc;
    for( i=0;i<a;i++)
    {
    cin>>b;
    vc.push_back(b);
    ct+=b;
    
    
    }
    sort(vc.begin(),vc.end());
    
  cout<<ct-vc[a-1]/2;



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >>n;
  bool hantei=false;
  for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
      if(i*j==n){
        hantei=true;
        break;
      }
    }
  }
  if(hantei){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
#define rp(i, f, t) for (int i = f; i < t; i++)
#define pr(i, f, t) for (int i = t - 1; i >= f; i--)
int main()
{
    ll n;
    cin >> n;
    ll mp[100000];
    rp(i, 0, 100000) mp[i] = 0;
    rp(i, 0, n)
    {
        ll nn = i + 1;
        ll nnn = nn % 10;
        while (nn >= 10)
        {
            nn /= 10;
        }
        mp[nn * 10 + nnn]++;
    }
    ll ans = 0;
    rp(i, 0, 10)
    {
        rp(j, 0, 10)
        {
            ans += mp[i * 10 + j] * mp[j * 10 + i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
	string a;
	cin>>a;
	sort(a.begin(),a.end());
	string b;
	cin>>b;
	sort(b.begin(),b.end());
	reverse(b.begin(),b.end());
	if(a>=b)cout<<"No";
	if(a<b)cout<<"Yes";
	return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        int p;
        cin >> p;
        A[p-1] = i;
    }
    
    int ans = 1;
    int cnt = 1;
    for (int i = 1; i < N; i++) {
        if (A[i-1] < A[i]) cnt++;
        else cnt = 1;
        ans = max(ans, cnt);
    }
    cout << N - ans << endl;
    return 0;
}

Measured memory_bytes: 1024
s = input()
t = input()
u = t
ans =0
count=0
maxans=0
if len(s) == len(t):
    for j in range(len(t)):
        if s[j] == t[j]:
            count+=1
    maxans = count
else:
    for i in range(len(s)-len(t)):
        count =0
        for j in range(len(t)):
            if s[j+i] == t[j]:
                count+=1
        maxans = max(maxans, count)

print(len(t)-maxans)




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

using namespace std;

int main() {
  int n, x;
  cin >> n >> x;

  int sum = 0;
  vector<int> v(n);

  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    sum += v[i];
  }

  int min = *min_element(v.begin(), v.end());

  cout << n + (x - sum) / min << endl;
}


Measured memory_bytes: 256
#include<iostream>
#define MAX 100001
#define NIL -1
using namespace std;

struct Node{
    int p,l,r;
};

Node T[MAX];
int D[MAX];

void print(int u){
    cout<<"node "<<u<<": ";
    cout<<"parent = "<<T[u].p<<", ";
    cout<<"depth = "<<D[u]<<", ";
    if(T[u].p==NIL) cout<<"root, ";
    else if(T[u].l==NIL) cout<<"leaf, ";
    else cout<<"internal node, ";
    cout<<'[';
    for(int i=0, c=T[u].l;c!=NIL;i++,c=T[c].r){
        if(i) cout<<", ";
        cout<<c;
    }
    cout<<']'<<endl;
}

void rec(int u,int p){
    D[u]=p;
    if(T[u].r!=NIL) rec(T[u].r,p);
    if(T[u].l!=NIL) rec(T[u].l,p+1);
}

int main(){
    int n,v,k,c,l,r;
    cin>>n;
    for(int i=0;i<n;i++) T[i].p=T[i].l=T[i].r=NIL;
    for(int i=0;i<n;i++){
        cin>>v>>k;
        for(int j=0;j<k;j++){
            cin>>c;
            if(j==0) T[v].l=c;
            else T[l].r=c;
            l=c;
            T[c].p=v;
        }
    }
    for(int i=0;i<n;i++){
        if(T[i].p==NIL) r=i;
    }
    rec(r,0);
    for(int i=0;i<n;i++) print(i);
}


Measured memory_bytes: 7700
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int n;
    int a[]={1,2,4,8,16,32,64};
    while(scanf("%d",&n)!=EOF)
    {
        if(n>64)
        {
            printf("64\n");
        }
        else
        {
            int i;
            for(i=0;i<7;i++)
            {
                if(n<a[i])
                {
                    break;
                }
            }
            printf("%d\n",a[i-1]);
        }
        
    }
    return 0;
}


Measured memory_bytes: 256
S['= r'],m[4]['= r'],z,d[4]={0,-2},k,i;f(i){m[k][i]=S[i]+47?0:m[k][i]?:1+f(d[k]-~i);}main(t){for(scanf("%*d%d",d),d[2]=-*d-2;S[++i-~*d]=~getchar(););for(;--i;z=fmax(z,t))for(t=k=0;k<4;++k)t+=f(i-~*d);printf("%d",z-3);}

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

int main(){
  int N;
  vector<long long> L(87);
  
  cin >> N;
  L.at(0)=2;
  L.at(1)=1;
  
  for(int i=2; i<=N; i++){
    L.at(i)=L.at(i-1) + L.at(i-2);
  }
  
  cout << L.at(N) << endl;
  
return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt(); //n個後の文字
		char[] s = stdIn.next().toCharArray(); //文字列S
		int [] ans = new int[s.length];
		char[] words = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
		int count = 0;
		
		for(int i = 0; i < s.length; i++) {
			for(int j = 0; j < words.length; j++) {
				
				if(s[i] == words[j]) {
				ans[count++] = j;
				}
			}
		
		}
		
		
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < ans.length; j++) {
				if(ans[j] == 25) {
					ans[j] = 0;
				}else {
					
				ans[j]++;
				}
				
			}
		
		}
	
	
		for(int i = 0; i < ans.length; i++) {
			System.out.print(words[ans[i]]);
		}
	}
}


Measured memory_bytes: 26132
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	double[] GR => Strs.Select(double.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	const long INFL = 4011686018427387913L;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F;
		var a = new bool[N, N];
		for (var i = 0; i < N; i++)
		{
			var I = G;
			for (var j = 0; j < N; j++) a[i, j] = I[j] > 0;
		}
		var dp = new long[1 << N];
		dp[0] = 1;
		for (var s = 1u; s < (1 << N); s++)
		{
			var n = BitCount(s);
			for (var j = 0; j < N; j++) if ((s & (1 << j)) != 0 && a[n - 1, j]) dp[s] = (dp[s] + dp[s ^ (1 << j)]) % MOD;
		}
		WriteLine(dp[(1 << N) - 1]);
	}
	public static int BitCount(uint n)
	{
		n = (n & 0x55555555) + ((n >> 1) & 0x55555555);
		n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
		n = (n & 0x0f0f0f0f) + ((n >> 4) & 0x0f0f0f0f);
		n = (n & 0x00ff00ff) + ((n >> 8) & 0x00ff00ff);
		return (int)((n & 0x0000ffff) + ((n >> 16) & 0x0000ffff));
	}
}


Measured memory_bytes: 29536
#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt
#include <sstream>	//stringstream,getline
#include <cmath>	//ceil,M_PI

using namespace std;

int main() {

	int A, B, C;
	cin >> A >> B >> C;

	swap(A, B);
	swap(A, C);

	cout << A << " " << B << " " << C << endl;

	return 0;

}

Measured memory_bytes: 3572
#pragma region includes, macros
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef int64_t i64;
typedef pair<i64, i64> P;

template<class T>
const T INF = numeric_limits<T>::max();
template<class T>
const T SINF = numeric_limits<T>::max() / 10;
static const i64 MOD = 1000000007;

//int dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//int dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//int dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge {
    i64 from, to, cost;
    edge(i64 to, i64 cost) : from(-1), to(to), cost(cost) {}
    edge(i64 src, i64 to, i64 cost) : from(src), to(to), cost(cost) {}
};

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
    for (auto& e : t) fill_v(e, v);
}
//

#pragma endregion

int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };

int main() {
    i64 r, g, b, n;
    cin >> r >> g >> b >> n;
    i64 ans = 0;
    for (int i = 0; i <= 3000; ++i) {
        for (int j = 0; j <= 3000; ++j) {
            if(0<= n - i * r - j * g && (n - i * r - j * g) % b == 0) ++ans;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;
static const ll LOGN=55;




int main(void) {
  ll N;
  cin >> N;
  string s;
  cin >> s;
  ll i, j;
  
  map<pair<string, string>, ll> mp;
  
  
  for(ll mask=0; mask<1<<N; mask++) {
    
    string a="", b="";
    for(i=0; i<N; i++) {
      if(mask>>i&1) a+=s[i];
      else b+=s[i];
    }
    
    mp[{a, b}]++;
  }
  
  
  ll ans=0;
  for(ll mask=0; mask<1<<N; mask++) {
    
    string a="", b="";
    for(i=0; i<N; i++) {
      if(mask>>i&1) a=s[N+i]+a;
      else b=s[N+i]+b;
    }
    
    
    ans+=mp[{a, b}];
  }
  
  pt(ans);
}






Measured memory_bytes: 87040
import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args){

		Scanner scanner=new Scanner(System.in);
		
		while(true){

		String a=scanner.next();
		int L=scanner.nextInt();

		if(a.equals("0")  && L == 0)
			return;
		
		ArrayList<Integer> list = new ArrayList<Integer>();
		PriorityQueue<String> q = new PriorityQueue<String>();
		//PriorityQueue reverse = new PriorityQueue();

//		LinkedList q = new LinkedList();

		
		list.add(Integer.parseInt(a));
		String[] array;

		for(int i=0;i<20;i++)
		{
			array = a.split("");

			for(int j = 0;j<L;j++)
			{
				if(j >= array.length)
				{
					q.add("0");
				}
				else
				{
					q.add(array[j]);
				}
			}


			String max = "";
			String min = "";


			for(int j=0;j<L;j++)
			{
				min += q.poll();
			}

			String min_array[] = min.split("");

			for(int j=L-1;j>=0;j--)
			{
				max += min_array[j];
			}

			//System.out.println(max + ":" + min);
			//System.out.println( Integer.parseInt(max) + ":" + Integer.parseInt(min));

			Integer result  = Integer.parseInt(max) - Integer.parseInt(min);

		//	System.out.print(i);
		//	System.out.print(" "+result);


			if(list.indexOf(result) != -1)
			{

//				System.out.println(list.get(0));
	//			System.out.println(list.get(1));
		//		System.out.println(list.get(2));
			//	System.out.println(list.get(3));



				System.out.print(list.indexOf(result));
				System.out.print(" "+result);
				int kekka = i - +list.indexOf(result)+1 ;
				System.out.println(" "+kekka);
				break;
			}


			list.add(result);

		     a = result.toString();



		}
		
		}

	}



}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;

typedef pair<int,int> P;
typedef pair<int,P> iP;
typedef pair<P,P> PP;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int a,b;
    cin>>a>>b;

    //cout <<fixed<<setprecision(16)<< << endl;
    if(a+b==15)cout << "+" <<endl;
    else if(a*b == 15)cout << "*" <<endl;
    else cout << "x" <<endl;

    return 0;
}


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

string reverse_partial(string str, int s, int e) {
    string top = s != 0 ? str.substr(0, s - 1) : "";
    string head = str.substr(s, e - s + 1);
    string tail = str.substr(e + 1, str.size());
    string reverse = "";
    for (int i=head.size()-1; i >= 0; i--) {
        reverse += head[i];
    }
    return (top + reverse + tail);
}

int main () {
    string str;
    cin >> str;
    int q;
    cin >> q;

    for (int i=0; i<q; i++) {
        string order, p;
        int a, b;
        cin >> order >> a >> b;
        if (order == "print") {
            cout << str.substr(a, b - a + 1) << "\n";
        }
        else if (order == "replace") {
            cin >> p;
            str = str.replace(a, b - a + 1, p);
        }
        else if (order == "reverse") {
            string sub = str.substr(a, b - a + 1);
            for (int i=0; i < sub.size(); i++) {
                str[i + a] = sub[sub.size() - i - 1];
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1220
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

//#define int long long
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

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 (b<a) { a=b; return 1; } return 0; }
template<class T>void put_double(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
template<class T>void print(T a){cout << a << endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    ll x; cin >> x;
    ll sum = 1, i = 2;
    while(sum < x) {
        sum += i;
        if(sum >= x) {
            print(i);
            return 0;
        }
        i++;
    }
    print(1);

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	vector<int> a(3);
	cin >> a[0] >> a[1] >> a[2];

	int m = INF;
	do{
		int n = 0;
		n += abs( a[0] - a[1] ) + abs( a[1] - a[2] );
		m = min( n , m );
	}while(next_permutation(a.begin(),a.end()));
	
	cout << m << endl;

	ret 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a;
  cin>>a;
  vector<string> b(a);
  rep(i,a)
    cin>>b[i];
  int c;
  cin>>c;
  vector<string> d(c);
  rep(i,c)
    cin>>d[i];
  int h=0;
  rep(i,a){
    int g=0;
  rep(j,a){
  if(b[i]==b[j])
    g++;
  }
    rep(j,c){
    if(b[i]==d[j])
      g--;
    }
    chmax(h,g);
  }
  out(h);
}


Measured memory_bytes: 3812
n = int(input())
a = list(map(int,input().split()))
ave = sum(a)/n
m = float('inf')
for i in a:
    m = min(m,abs(ave-i))

for k,i in enumerate(a):
    if abs(abs(i-ave)-m) <= 10**(-6):
        print(k)
        exit()


Measured memory_bytes: 2940
#include<iostream>
#include<cstdio>
#include<string.h>
using namespace std;



#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch) {
	if (ch == 'A')return 1;
	else if (ch == 'C')return 2;
	else if (ch == 'G')return 3;
	else if (ch == 'T')return 4;
	else return 0;
}

long long getKey(char str[]) {
	long long sum = 0, p = 1, i;
	for (i = 0; i < strlen(str); i++) {
		sum += p * (getChar(str[i]));
		p *= 5;
	}
	return sum;
}

int h1(int key) {
	return key % M;
}
int h2(int key) {
	return 1 + (key % (M - 1));
}

int find(char str[]) {
	long long key, i, h;
	key = getKey(str);
	for (i = 0;; i++) {
		h = (h1(key) + i * h2(key)) % M;
		if (strcmp(H[h], str) == 0)return 1;
		else if (strlen(H[h]) == 0)return 0;
	}
	return 0;
}

int insert(char str[]) {
	long long key, i, h;
	key = getKey(str);
	for (i = 0;; i++) {
		h = (h1(key) + i * h2(key)) % M;
		if (strcmp(H[h], str) == 0)return 1;
		else if (strlen(H[h]) == 0) {
			strcpy(H[h], str);
			return 0;
		}
	}
	return 0;
}


int main() {
	int i, n, h;
	char str[L], com[9];
	for (i = 0; i < M; i++)H[i][0] = '\0';
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s %s", com, str);

		if (com[0] == 'i') {
			insert(str);
		}
		else {
			if (find(str)) {
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}
	}
	return 0;
}


Measured memory_bytes: 17460
//#include <bits/stdc++.h>
#include<iostream>
#include<string>
#include<queue>
#include<vector>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)//初期値a,i<bの範囲でループ
#define REP(i,n) FOR(i,0,n)//初期値0,i<nの範囲でループ
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;



int main(){
    string s;
    cin>>s;

    for(;;){
        if(s.size()==0)break;
        string s5,s6,s7;
        if(s.size()>=5)s5=s.substr(s.size()-5,5);
        if(s.size()>=6)s6=s.substr(s.size()-6,6);
        if(s.size()>=7)s7=s.substr(s.size()-7,7);

        if(s6=="eraser"){
            s=s.substr(0,s.size()-6);
        }else if(s5=="erase"){
            s=s.substr(0,s.size()-5);
        }else if(s7=="dreamer"){
            s=s.substr(0,s.size()-7);
        }else if(s5=="dream"){
            s=s.substr(0,s.size()-5);
        }else{
            cout<<"NO";
            return 0;
        }


    }
    cout<<"YES";
    

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MAXX 100005
#define PI 3.14159265358979323846264338327950
#define ll signed long long int
using namespace std;
ll t , n, k,   y = 2, m,h,s , ans =0;
ll a[MAXX] = {0}, b, c[MAXX];
vector<ll> adj[MAXX];
bool used[MAXX];


signed main()
{
	FAST;
	cin >> n;
	for(ll i = 0; i < n; i++){
		cin >> a[i];
		if(i >= 1 && a[i]- a[i-1] == 1){
			ans ++;
		}
		c[i] = a[i];
	}
	sort(c, c+n);
	for(ll i = 0; i < n; i++){
		if(a[i] != c[i]){
			m ++;
		}
	}
	if(m == 2 || ans == n-1){
		cout << "YES";
	}
	else{
		cout << "NO";
	}
	
}

Measured memory_bytes: 2560
#include<iostream>
using namespace std;
#define MAX 1000000
main(){
    int T1[MAX], T2[MAX];
    for ( int i = 0; i < MAX; i++ ) T1[i] = T2[i] = i;
    int  n = 1;
    while(1){
	int i = n*(n+1)*(n+2)/6;
	if ( i >= MAX ) break;

	for ( int j = i; j < MAX; j++ ) T1[j] = min(T1[j], T1[j-i]+1);
	if ( i % 2 ){
	    for ( int j = i; j < MAX; j++ ) T2[j] = min(T2[j], T2[j-i]+1);
	}
	n++;
    }

    while(1){
	cin >> n;
	if ( n == 0 ) break;
	cout << T1[n] << " " << T2[n] << endl;
    }
}

Measured memory_bytes: 8612
import itertools
N = int(input())
s = "MARCH"
dct = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0}
for i in range(N):
  begin = input()[0] 
  if begin in dct.keys():
    dct[begin] += 1
cmb = itertools.combinations(list(dct.keys()), 3)
ans = 0
for i in list(cmb):
  n = 1
  for j in i:
    n *= dct[j]
  ans += n
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"Yes"<<endl
#define cno cout<<"No"<<endl
#define sp <<" "<<
#define cst(x) cout<<fixed<<setprecision(x)
#define pi 3.14159265359
#define mod 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;

int main(){

    int h,w; cin >> h >> w;
    int H,W;
    H = h/2; W = w/2;
    map<char,int> mp;
    for(char c = 'a'; c <= 'z'; c++){
        mp[c] = 0;
    }
    for(char c = 'A'; c <= 'Z'; c++){
        mp[c] = 0;
    }
    rep(i,h)rep(j,w){
        char c; cin >> c;
        ++mp.at(c);
    }
    bool ok = true;
    if(h%2 == 0 && w%2 == 0){
        for(char c = 'a'; c <= 'z'; c++){
            if(mp.at(c)%4 != 0) ok = false;
        }
        for(char c = 'A'; c <= 'Z'; c++){
            if(mp.at(c)%4 != 0) ok = false;
        }
        ok? cyes : cno;
    }
    else if(h%2 == 1 && w%2 == 1){
        int cnt_odd = 0;
        int cnt_four = 0;
        for(char c = 'a'; c <= 'z'; c++){
            if(mp.at(c)%2 == 1) ++cnt_odd;
            cnt_four += mp.at(c)/4;
        }
        for(char c = 'A'; c <= 'Z'; c++){
            if(mp.at(c)%2 == 1) ++cnt_odd;
            cnt_four += mp.at(c)/4;
        }
        if(cnt_odd > 1) ok = false;
        if(cnt_four < H*W) ok = false;

        ok? cyes : cno;
    }
    else{
        int cnt_odd = 0;
        int cnt_four = 0;
        for(char c = 'a'; c <= 'z'; c++){
            if(mp.at(c)%2 == 1) ++cnt_odd;
            cnt_four += mp.at(c)/4;
        }
        for(char c = 'A'; c <= 'Z'; c++){
            if(mp.at(c)%2 == 1) ++cnt_odd;
            cnt_four += mp.at(c)/4;
        }
        if(cnt_odd > 0) ok = false;
        if(cnt_four < H*W) ok = false;

        ok? cyes : cno;
    }
    return 0;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
# from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

A = list(map(int, input().split()))
for i in range(5):
    if A[i] == 0:
        print(i+1)
        exit()


Measured memory_bytes: 68044
n, k, q = (int(i) for i in input().split())
a = [k]*n
d = [0]+[a[i]-a[i-1] for i in range(1,n)]+[0]
for i in range(q):
  x = int(input())-1
  d[0]-=1
  d[x]+=1
  d[x+1]-=1
  d[n]+=1
a[0]+=d[0]
for i in range(1,n):a[i] = a[i-1]+d[i]
for i in range(n): print("Yes" if a[i]>0 else "No")

Measured memory_bytes: 8704
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
using namespace std;


int main(){
    string in;
    char siin[] = "w kstnhmyr";
    map<char,char> dic;

    dic['T'] = 'a';
    dic['L'] = 'i';
    dic['U'] = 'u';
    dic['R'] = 'e';
    dic['D'] = 'o';

    while(cin >> in){
        string ret;
        for(int i=0; i<in.size(); i+=2){
            if(in[i] == '0' && in[i+1] == 'U')
                ret += "nn";
            else{
                if(in[i] != '1')
                    ret += siin[in[i] - '0'];
                ret += dic[in[i+1]];
            }
        }
        cout << ret << endl;
    }
}
    

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,k;
  cin >> n >> k;
  ll a[n];
  ll psum[n+1];
  ll msum[n+1];
  ll ans=-1LL*1e15;
  psum[0]=0;msum[0]=0;
  rep(i,n){
    cin >> a[i];
    psum[i+1]=psum[i];
    msum[i+1]=msum[i];
    if(a[i]>0){
      psum[i+1] +=a[i];      
    }
    else msum[i+1]+=a[i];

  }
  
  rep(i,n-k+1){
    ll t=psum[n];
    //    cout << t << endl;
    ans=max(ans,t+msum[i+k]-msum[i]);
    ans=max(ans,t-psum[i+k]+psum[i]);
  }

  
  cout << ans << endl;
  return 0;
    

}


Measured memory_bytes: 2560
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    long long int n,a,b;
    cin >> n >> a >> b;
    if(a > b || (n ==  1 && a != b))
    {
        cout << "0\n";
    }
    else if(n == 1 && a == b)
    {
        cout << "1\n";
    }
    else
    {
        cout << (b - a) * (n - 2) + 1 << "\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int j = 0;

        while (j == 0) {
            int tyukan = scanner.nextInt();
            int kimatu = scanner.nextInt();
            int saishi = scanner.nextInt();

            if (tyukan == -1 && kimatu == -1 && saishi == -1) {
                break; 
            }else if(tyukan==-1||kimatu==-1){
                System.out.println("F");
            } 
            else if ((tyukan + kimatu) >= 80) {
                System.out.println("A");
            } else if ((tyukan + kimatu) >= 65) {
                System.out.println("B");
            } else if ((tyukan + kimatu) >= 50||saishi>=50) {
                System.out.println("C");
            } else if ((tyukan + kimatu) >= 30) {
                System.out.println("D");
            } else {
                System.out.println("F");
            }
        }
    }
}

Measured memory_bytes: 26368
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 17:52:43 2019

@author: nakamuratakayuki
"""

atoe = []
for i in range(5):
    atoe.append(int(input()))
k = int(input())
ans = 'Yay!'
if atoe[4]-atoe[0] > k:
        ans = ':('
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
                                        #include<iostream>
                                        #include<cstdio>
                                        #include<vector>
                                        #include<queue>
                                        #include<map>
                                        #include<cstring>
                                        #include<string>
                                        #include <math.h>
                                        #include<algorithm>
                                    //    #include <boost/multiprecision/cpp_int.hpp>
                                        #include<functional>
                                #define int long long
                                        #define inf  1000000007
                                        #define pa pair<int,int>
                                        #define ll long long
                                        #define pal pair<double,pa>
                                        #define ppa pair<int,int>
                                        #define ppap pair<pa,pa>
                                        #define ssa pair<string,int>
                                        #define  mp make_pair
                                        #define  pb push_back
                                        #define EPS (1e-10)
                                        #define equals(a,b) (fabs((a)-(b))<EPS)
                                  #define VI vector<int>
                                        using namespace std;


int gcd(int a,int b){
	if(a<b) return gcd(b,a);
	if(b==0) return a;
	if(a%b==0) return b;
	return gcd(b,a%b);
}

           signed main(){
               int n,m;
 			
           	cin>>n;
           	int ans=0;
           	for(int i=0;i<n;i++){
           		cin>>m;
           		if(m==2){
           		ans++;
           			continue;
           		}
           		if(m%2==0){
           		continue;
           		
           		}
           		bool b=true;
           	for(int i=3;i<min(10001ll,m-1);i+=2){
           		if(m%i==0){
           		b=false;
           			break;
           		}
           	}
           		if(b)	ans++;
           	}
         
           	
           	cout<<ans<<endl;
           }
             

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define MOD int(1e9+7)
#define pb push_back
using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    
    if(n==m) cout<<"Yes";
    else cout<<"No";
    return 0;
}



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

int main(){
    int m, n;
    cin >> n >> m;
    int a[n], b[n], c[m], d[m];
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    for(int i = 0; i < m; i++) cin >> c[i] >> d[i];

    for(int i = 0; i < n; i++){
        long long min = 1LL << 60;
        int ans = 1;
        for(int j = 0; j < m; j++){
            int ab = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if(ab < min){
                ans = j + 1;
                min = ab;
            }
        }
        cout << ans << endl;
    }
    return 0; 
}


Measured memory_bytes: 256
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

W = ['Sunny', 'Cloudy', 'Rainy']
A = readline().decode('utf8').rstrip()

print(W[(W.index(A) + 1) % 3])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1001001001
#define LINF 1001001001001001001
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;

/*
    BIT: Binary Indexed Tree (1-indexed)
*/
class BIT {
    private:
        ll N;
        vector<ll> bit;

    public:
        BIT(ll n, ll initial_value);
        void add(ll i, ll x);
        ll sum(ll i);
};

BIT::BIT(ll n, ll initial_value) {
    N = n;
    bit.resize(N + 1, initial_value);
}

// i番目 (1-indexed) の要素にxを加える
void BIT::add(ll i, ll x) {
    while (i <= N) {
        bit[i] += x;
        i += i & -i;
    }
}

// 区間[1, i] (1-indexed) の要素の和を求める
ll BIT::sum(ll i) {
    ll ans = 0;
    while (i > 0) {
        ans += bit[i];
        i -= i & -i;
    }
    return ans;
}

int main() {

  int N, Q;
  cin >> N >> Q;
  vector<int> C(N + 1);
  rep(i,N) cin >> C[i + 1];
  vector<int> L(Q), R(Q);
  rep(i,Q) cin >> L[i] >> R[i];
  vector<P> query(Q);
  rep(i,Q) {
    query[i].first = R[i];
    query[i].second = L[i];
  }

  vector<int> last(N + 1, -1);
  sort(query.begin(), query.end());
  int now_r = 1;

  BIT tree(N, 0);

  map<P, ll> ans; 

  rep(i,Q) {
    while (now_r <= query[i].first) {
      if (last[C[now_r]] > 0) tree.add(last[C[now_r]], -1);
      tree.add(now_r, 1);
      last[C[now_r]] = now_r;
      now_r++;
    }
    ans[query[i]] = tree.sum(query[i].first) - tree.sum(query[i].second - 1);
  }

  rep(i,Q) cout << ans[make_pair(R[i], L[i])] << "\n";
      
  return 0;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    int k[m], p[m];
    vector<int> s[m];
    for (int i = 0; i < m; i++) {
        cin >> k[i];
        for (int j = 0; j < k[i]; j++) {
            int t;
            cin >> t;
            t--;
            s[i].push_back(t);
        }
    }
    for (int i = 0; i < m; i++) {
        cin >> p[i];
    }
    int ans = 0;
    for (int mask = 0; mask < (1 << n); mask++) {
        bool flag = true;
        for (int i = 0; i < m; i++) {
            int bit = 0;
            for (int j = 0; j < k[i]; j++) {
                if (mask & (1 << s[i][j])) {
                    bit++;
                }
            }
            if ((bit & 1) != p[i]) {
                flag = false;
                break;
            }
        }
        if (flag) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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 (b<a) { a=b; return 1; } return 0; }

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cout << a[i] << " "; cout << "\n"; }
template<class T> void verr(const vector<T>& v){ for(auto& a : v) cout << a << " "; cout << "\n"; }
ll dbgt = 1; void err() { cout << "passed " << dbgt++ << "\n"; }
template<class H, class... T> void err(H&& h,T&&... t){ cout<< h << (sizeof...(t)?" ":"\n"); if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll X;
    cin >> X;
    ll ans = 0;
    ans += X / 500 * 1000;
    X %= 500;
    ans += X / 5 * 5;
    cout << ans << endl;
}

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

ll gcd(ll x,ll y){
  if(y==0) return x;
  return gcd(y,x%y);
}

int main(){
  ll n,m; cin>>n>>m;
  string s,t; cin>>s>>t;
  ll j=0;
  for(int i=0;i<n;i++){
    while(i*m>n*j && j<m){
      j++;
    }
    if(m*i==n*j){
      if(s[i]!=t[j]){
        cout<<-1<<endl;
        return 0;
      }
    }
  }
  cout<<n*m/gcd(n,m)<<endl;
}

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

int main() {
   int A,B,C;
  cin>>A>>B>>C;
  if(A==B&&A!=C){
    cout<<"Yes"<< endl;
    return 0;
  }
  if(B==C&&A!=C){
    cout<<"Yes"<< endl;
    return 0;
  }
  if(C==A&&A!=B){
    cout<<"Yes"<< endl;
    return 0;
  }
  cout<<"No"<< endl;
}
  

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int Z = sc.nextInt();
    int ans = X / (Y+Z);
    if(X %(Y+Z) >= Z){
      System.out.println(ans);
    }else{
      System.out.println(ans-1);
    }
    
  }
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int sum = 0;

        for (int i = 1; i <= n; i++) {
            int sumOfDigit = getSumOfEachDigit(i);
            if (a <= sumOfDigit && sumOfDigit <= b) {
                sum += i;
            }
        }
        System.out.println(sum);
    }

    private static int getSumOfEachDigit(int num) {
        // numが1234の場合
        // len: 4
        int len = String.valueOf(num).length();
        int sum = 0;
        // d: 1000
        int d = (int)Math.pow(10, len - 1);
        for (int i = 0; i < len; i++) {
            // nums: [1, 2, 3, 4]
            sum += num / d;
            // num: 234
            num %= d;
            // d: 100
            d /= 10;
        }
        return sum;
    }
}


Measured memory_bytes: 23124
#include<stdio.h>
#define N 200000

int main(){
  int max,min,i,j,n,R[N];
  
  scanf("%d",&n);
  for(j=0;j<n;j++){
    scanf("%d",&R[j]);
  }
  min=R[0];
  max=R[1]-R[0];
  
  for(j=1;j<n;j++){
    if(max<R[j]-min)
      max=R[j]-min;
    if(min>R[j])
      min=R[j];
  }
  printf("%d\n",max);
  return 0;
  
}
    

Measured memory_bytes: 1376
#include <stdio.h>

int main(void){
  long long A, B;
  int K;
  scanf("%lld%lld%d", &A, &B, &K);

  for (int i = 0; i < K/2; i++) {
    if(A%2 != 0) A--;
    A /= 2;
    B += A;
    if(B%2 != 0) B--;
    B /= 2;
    A += B;
  }
  if(K%2 != 0){
    if(A%2 != 0) A--;
    A /= 2;
    B += A;
  }

  printf("%lld %lld\n", A, B);

  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
int main() {
	int n,a,b;
	int sum = 0;
	int gransum = 0;
	int x;
	std::cin >> n;
	std::cin >> a;
	std::cin >> b;
	for (int i = 1; i <= n; i++) {
		x = i;
		while (x >= 1) {
			sum += x % 10;
			x = x/10;
		}
		if (sum >= a&& sum <= b) {
			gransum+=i;
		}
		sum = 0;
	}
	std::cout << gransum;
	return 0;
}

Measured memory_bytes: 256