akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P std::pair<int,int>
#define PiP std::pair<int,std::pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp std::make_pair
#define prique(T) std::priority_queue<T,vector<T>,greater<T>>
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = std::max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = std::min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	std::random_device rnd;
	std::mt19937 mt32(rnd());
	std::uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt32);
}
/*--------Library Zone!--------*/

int n,m;
vector<int>G[114514];
int nyuji[114514],dis[114514];
signed main() {
	cin>>n>>m;
	rep(i,m){
		int a,b;cin>>a>>b;a--;b--;
		G[a].push_back(b);
		nyuji[b]++;
	}
	queue<int>que;
	rep(i,n){
		if(!nyuji[i]){
			que.push(i);dis[i]=0;
		}else {
			dis[i]=-1;
		}
	}
	while(!que.empty()){
		int i=que.front();que.pop();
		for(int j:G[i]){
			nyuji[j]--;
			if(!nyuji[j]){
				dis[j]=dis[i]+1;
				que.push(j);
			}
		}
	}
	int ans=0;
	rep(i,n){
		chmax(ans,dis[i]);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 7680
import java.util.Scanner;
class Main
{
	static void sort( int A[] )
	{
		int counter = 0;
		for( int i = 0 ; i < A.length ; i++ )
		{
			int min = i;
			for( int j = i ; j < A.length ; j++ )
				if( A[j] < A[min] )min = j;
			if( min!=i )
			{
				int work = A[i];
				A[i] = A[min];
				A[min] = work;
				counter++;
			}
		}
		for( int i = 0 ; i < A.length ; i++ )
			if( i==A.length-1 )
				System.out.printf( "%d\n%d\n", A[i], counter );
			else
				System.out.print( A[i]+" " );
	}
	public static void main( String[] args )
	{
		Scanner sc = new java.util.Scanner( System.in );
		
		int n = sc.nextInt();
		int A[] = new int[n];
		for( int i = 0 ; i < n ; i++ )A[i]=sc.nextInt();
		
		sort( A );
	}
}

Measured memory_bytes: 26312
using System;

class Program
{
  static void Main(string[] args)
  {
    string[] input = Console.ReadLine().Split(' ');
    int n = int.Parse(input[0]);
    int l = int.Parse(input[1]);
    string[] s = new string[n];
    for (int i = 0; i < n; i++)
    {
      s[i] = Console.ReadLine();
    }
    Array.Sort(s, StringComparer.OrdinalIgnoreCase);
    Console.WriteLine(string.Join("", s));
  }
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;
#define debug(x) cerr << #x << ": " << (x) << "\n";

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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;
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x, y, z;
  cin >> x >> y >> z;
  swap(x, y);
  swap(x, z);
  cout << x << " " << y << " " << z << endl;

  return 0;
};


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

using ll=long long; 

int func(int x){
	int cnt=0;
	while(x%2==0){
		x/=2;
		cnt++;
	}
	return cnt;
}

void solve(){
	int n;
	cin>>n;
	vector<int> a(n);
	int mini=10000;
	for(int i=0; i<n; i++)cin>>a[i];
	for(int i=0; i<n; i++){
		int x=func(a[i]);
		mini=min(mini, x);
	}
	cout<<mini<<endl;
}

signed main(){
	//while(1)
	solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1<<20;
char s[N],t[N];

long long gcd(long long a,long long b)
{
	return b?gcd(b,a%b):a;
}

int main()
{
	long long n,m;
	cin>>n>>m;
	scanf("%s%s",s,t);
	for(long long i=0,j=0;i<n && j<m;i*m<j*n?i++:j++)
	{
		//printf("i=%lld j=%lld\n",i,j);
		if(i*m==j*n && s[i]!=t[j])
		{
			puts("-1");
			return 0;
		}
	}
	cout<<n*m/gcd(n,m)<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    vector<ll> a;
    ll sum = 0;
    for (ll i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        sum += temp;
        if (temp % 10 != 0)
        {
            a.push_back(temp);
        }
    }

    sort(a.begin(), a.end());

    if (sum % 10 == 0)
    {
        if (!a.empty())
        {
            sum -= a[0];
        }
        else
        {
            cout << 0 << endl;
            exit(0);
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    private static final Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int ans = 0;
        for (; a<=b; a++) {
            if(c%a==0) ++ans;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 26148
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
using namespace std;
int main() {
	int n, k, a[100010], ans = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	for (int i = n - k; i < n; i++)ans += a[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n, m, p[100010], f[100010];

int find(int x) {
	if(f[x] == x) return f[x];
		else return f[x] = find(f[x]);
} 

int main()
{
	cin>>n>>m;
	for(int i=1; i<=n; i++) cin>>p[i], f[i] = i;
	for(int i=1; i<=m; i++) {
		int x, y;
		cin>>x>>y;
		int root1 = find(x), root2 = find(y);
		if(root1 != root2) f[root2] = root1;
	}
	int ans = 0;
	for(int i=1; i<=n; i++) 
		if(find(p[i]) == find(i)) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
/**********************************************************************/
/********                                                      ********/
/********                     Writer:孙~~                      ********/
/********                       Lang:C++                       ********/
/********                     Status:Unknow                    ********/
/********                                                      ********/
/**********************************************************************/
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <list>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <cstring>
#include <cmath>
//#include<bits/stdc++.h>
using namespace std;

const int INF=0x3f3f3f3f;

int main(){
	long long a,b,c,d;
	int k;
	scanf("%lld%lld%lld%d",&a,&b,&c,&k);
	if(k%2==0){
		d=a-b;
		if(a>b && d<0 || b>a && d>0){
			puts("Unfair");
			return 0;
		}
	}
	else{
		d=b-a;
		if(b>a && d<0 || b<a && d>0){
			puts("Unfair");
			return 0;
		}
	}
	if(d>1e18 || d<-1e18){
		puts("Unfair");
		return 0;
	}
	printf("%lld",d);
	return 0;
}




Measured memory_bytes: 256
#include <stdio.h> 
 
int main(void)
{
  int n,x;
  int b,i,j,k,a;
 
  while(1) {
    scanf("%d %d",&n,&x);   
    b = 0;
    if( n == 0 && x == 0){
      break;
    }
    for(k = 1; k <= n ; k++) {
      for(j = 1; j <= n ; j++) {
	for(i = 1; i <= n; i++) {
       
      if(i == j || j == k || i ==k) {
         
      }else{
        a = i + j + k;
        if(a == x) {
          
          b += 1;
  
        }
      }  
    }
      }
    }
    printf("%d\n",b/6);
  }
return 0;
}



Measured memory_bytes: 2104
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var X = r[2];
            var Y = r[3];
            var xs = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var ys = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var maxX = xs.Max();
            var minY = ys.Min();
            for (int i = X + 1; i <= Y; i++)
            {
                if (maxX < i && minY >= i)
                {
                    Console.WriteLine("No War");
                    return;
                }
            }
            Console.WriteLine("War");
        }
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <vector>
#include <climits>

using namespace std;


bool check_understanding(int X, vector<int> understanding);

inline bool check_understanding(int X, vector<int> understanding){
  bool ret = true;
  for(unsigned long i = 0; i < understanding.size(); i++){
    if(understanding[i] < X)
      ret = false;
  }
  
  return ret;
}

int main(void){
    int N, M, X;
    cin >> N >> M >> X;

    vector<int> C(N);
    vector<vector<int>> A(N, vector<int>(M));
    for(int i = 0; i < N; i++){
        cin >> C[i];
        for(int j = 0; j < M; j++)
	  cin >> A[i][j];
    }
    
    int ans = INT_MAX;
    int all = 1<<N;
    for(int mask = 0; mask < all; mask++){
      vector<int> understanding(M, 0);
        int cost = 0;
        for(int i = 0; i < N; i++){
            if((mask >> i) & 1){
                cost += C[i];
                for(int j = 0; j < M; j++)
		  understanding[j] += A[i][j];
                
            }
        }
        if(check_understanding(X, understanding))
	   ans = min(ans,cost);
    }
    cout << (ans == INT_MAX ? -1  : ans) << endl;

    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
using namespace std;

#define MOD 1000000007
#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    int n, a;
    cin >> n >> a;

    int num = n * n;
    num = num - a;
    p(num);    
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
int inf = 1000000000;

class node{
public:
  int to;
  int from;
  int cost;
};

int main(void) {

  int n; scanf("%d", &n);
  vector< vector<node> > v(n);
  for(int i=0; i<n; i++){
    int u, k;
    scanf("%d %d", &u, &k);
    for(int j=0; j<k; j++){
      int vv, c;
      scanf("%d %d", &vv, &c);
      node t;
      t.from = u;
      t.to = vv;
      t.cost = c;
      v[u].push_back(t);
    }
  }

  vector<int> dist(n, inf);
  vector<bool> vis(n, false);

  priority_queue< pair<int, int> > pq;
  pq.push(make_pair(0, 0));
  dist[0] = 0;
  vis[0] = true;
  while( !pq.empty() ){
    pair<int, int> pos = pq.top();
    pq.pop();
    int p = pos.second;
    vis[p] = true;
    for(int i=0; i<v[p].size(); i++){
      if( vis[v[p][i].to] ) continue;
      int tmp = dist[v[p][i].from] + v[p][i].cost;
      if( dist[v[p][i].to] <= tmp ) continue;

      dist[v[p][i].to] = tmp;
      pq.push(make_pair(dist[v[p][i].to]*-1, v[p][i].to));

    }

  }

  for(int i=0; i<n; i++){
    cout << i << " " << dist[i] << endl;
  }

  return 0;
}

// EOF

Measured memory_bytes: 9928
import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
	 Scanner sc = new Scanner(System.in);
	 int a = sc.nextInt();
	 int b = sc.nextInt();
	 int c = sc.nextInt();
	 if (a+b>=c){
	 	System.out.println("Yes");
	 	}
	 else{
	 	System.out.println("No");
	            }
              
	}
}

Measured memory_bytes: 21972
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=1e9+7;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
ll h[111111], v[111111], a, b, n, lef, rig, mid, best;

bool isok(ll T)
{
	int i; ll req=0;
	for(i=1 ; i<=n ; i++) v[i]=h[i]-b*T;
	for(i=1 ; i<=n ; i++) if(v[i]>0) req+=(v[i]+(a-b)-1)/(a-b);
	return req<=T;
}

int main(void)
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n>>a>>b; int i;
	for(i=1 ; i<=n ; i++) cin>>h[i];
	lef=1; rig=1e9+5;
	while(lef<=rig)
	{
		mid=(lef+rig)/2;
		if(isok(mid)) best=mid, rig=mid-1;
		else lef=mid+1;
	}
	cout<<best; return 0;
}

// 제출하기 전에 생각햇나요?
// it may be easier/harder than you think
// ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define ANS cout << ans << endl
#define RETURN(x)    \
  cout << x << endl; \
  return 0
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  init();
  ll N;
  cin >> N;
  vll A(N);
  rep(i, N) cin >> A[i];
  map<ll, ll> m;
  rep(i, N) m[A[i]]++;

  ll ans = 0;
  ll count = 0;
  for (auto mm : m) {
    if (mm.second == 1) ans++;
    if (mm.second >= 2) {
      ans++;
      count += mm.second - 1;
    }
  }
  if (count % 2 == 1) ans--;
  COUT(ans);
  return 0;
}

Measured memory_bytes: 10252
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll n,k; cin>>n>>k;
    vector<ll> a(n);
    ll tmp=0;
    rep(i,n){
        cin>>a[i];
        if(a[i]==1) tmp=i;
    }
    ll res=0;
    k--;
    res+=tmp/k;
    if(tmp%k!=0) res++;
    ll x=k-tmp%k;
    if(x==k) x=0;
    tmp=n-1-tmp-x;
    chmax(tmp,0ll);
    res+=tmp/k;
    if(tmp%k!=0) res++;
    cout<<res<<endl;
    return 0;
}

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

int main(void){

  string s;
  cin >> s;

  if(s[0]==s[1] && s[2]==s[3] && s[1]!=s[2]){
    cout << "Yes" << endl;
  }
  else if(s[0]==s[2] && s[1]==s[3] && s[1]!=s[2]){
    cout << "Yes" << endl;
  }
  else if(s[0]==s[3] && s[1]==s[2] && s[1]!=s[3]){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

  return 0;
}


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

int main()
{
    char s[10],tenki[3][10]={"Sunny","Cloudy","Rainy"};
    scanf("%s",s);

    for (int i = 0; i < 3; i++)
    {
        if(strcmp(s,tenki[i]) == 0)
        {
            printf(tenki[(i + 1) % 3]);
        }
    }
    
}


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

#define ll long long int
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pb push_back
#define el '\n'
#define N 1000000007
#define re return
#define PI 3.14159265
#define take(a,n) for(int i=0;i<(n);i++) cin>>(a)[i]
#define out(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" ";
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int (i)=0;i<(n);(i)++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}


ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}


ll poww(ll a,ll b)
{
  ll ans=1;
  for(int i=1;i<=b;i++)
  {
    ans*=a;
  }
  return ans;
}

ll max(ll a, ll b)
{
  if(a>b) re a;
  else re b;
}

ll ncr(int n,int r)
{
  ll ans=1;
  forup(i,r)
  {
    ans=(ans*(n-i)/(i+1))%N;
  }
  re ans;
}

int main()
{
  int t;
  t=1;
  while(t--)
  {
    int n;
    cin>>n;
    int a[3*n];
    forup(i,3*n)
    {
      cin>>a[i];
    }
    ll sleft=0,sright=0;
    map<int,int> right, left, neww;
    forup(i,n) {left[a[i]]++;sleft+=a[i];}
    forup(i,2*n) {right[a[3*n-i-1]]++;}
    int c=0;
    vi z;
    for(auto x=right.begin();x!=right.end();)
    {
      if(c==n) break;
      sright+=x->first;
      neww[x->first]++;
      right[x->first]--;
      if(right[x->first]==0) {z.pb(x->first);x++;}
      c++;
    }

    for(auto x:z)
      right.erase(x);

    ll diff=sleft-sright;
    for(int i=n;i<2*n;i++)
    {
      sleft+=a[i];
      left[a[i]]++;
      auto x=left.begin();
      sleft-=x->first;
      left[x->first]--;
      if(left[x->first]==0) left.erase(x->first);
      auto y=neww.find(a[i]);
      if(y!=neww.end())
      {
        neww[y->first]--;
        sright-=y->first;
        if(neww[y->first]==0) neww.erase(y->first);
        auto m=right.begin();
        neww[m->first]++;
        sright+=m->first;
        right[m->first]--;
        if(right[m->first]==0) right.erase(m->first);
      }
      else
      {
        y=right.find(a[i]);
        right[y->first]--;
        if(right[y->first]==0) right.erase(y->first);
      }

      diff=max(diff,sleft-sright);
    }

    cout<<diff;
  }


}


Measured memory_bytes: 20472
#include <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <cstring>
#include <bits/stdc++.h>
#include <iostream>
#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define ll long long
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
#define enterarray(a,n) for(int i=0;i<(int)(n);++i)cin>>a[i];
#define ins insert
const int MOD =998244353;
const int MX = int(2e6+9);
using namespace std;
ll f[200004];
int even(ll num){
    if(num%2==0)return 1;
    else return 0;
}
void printvector(vector<int> v){
    int i;
    for0(i,v.size())cout<<v[i]<<" ";
}
void solve(){
    ll n,m,i,j,k;
    ll a[200005],b[200005];
    ll ans=INT_MAX,res=0;
    bool flag=true;
    vector<ll> v;
    string s,t;
    //set<ll> s;
    cin>>s>>t;
    n=s.length();m=t.length();
    for0(i,n-m+1){
        res=0;
        for0(j,m){
            if(s[i+j]!=t[j])res++;
        }
        ans=min(ans,res);
    }
    cout<<ans;
}
 
int main()
{
    FAST;
   int t;
    t=1;
    while(t--)
    {
        solve();
        cout<<"\n";
    }
}

    

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

bool isP(string s){
    int l=s.length();
    for(int i=0;i<=l/2;++i){
        if(s[i]!=s[l-i-1]){
            return false;
        }
    }
    return true;
}

int main() {
    string s;
    cin>>s;
    int N=s.length();
    
    string a=s.substr(0,(N-1)/2);string b=s.substr((N+1)/2);
    if(isP(s)&&isP(a)&&isP(b))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
#define sf(n) scanf("%lld",&n)
#define sff(n,m) scanf("%lld %lld",&n,&m)
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PLL pair<ll,ll>
#define mod 1000000007
#define mx 100002
#define FILE freopen("input.txt","r",stdin)

ll Set(ll N,ll pos){return N=N|(1LL<<pos);}
bool check(ll N,ll pos){return (bool)(N & (1LL<<pos));}

ll a[23][23];
ll n;
ll dp[25][3+(1LL<<23)];

ll F(ll i,ll mask)
{
  if(mask==((1LL<<n)-1)) return 1;
  if(dp[i][mask]!=-1) return dp[i][mask];

  ll ret = 0;

  for(ll j = 0;j<n;j++)
  {
    if(!check(mask,j)&&a[i+1][j+1]){
       ret = (ret%mod + F(i+1,Set(mask,j))%mod)%mod;
    }
  }

  return dp[i][mask] = ret;
}

int main()
{
fastio
cin>>n;

for(ll i = 1;i<=n;i++)
{
  for(ll j = 1;j<=n;j++)
  {
    cin>>a[i][j];
  }
}

memset(dp,-1,sizeof dp);
cout<<F(0,0)<<endl;

return 0;
}


Measured memory_bytes: 819456
W, H, x, y, r = list(map(int, input().split()))
# x axis
# x - r >= 0
# x + r <= W

# y axis
# y - r >= 0
# y + r <= H
xline = False
yline = False

if x - r >= 0 and x + r <= W:
    xline = True

if y - r >= 0 and y + r <= H:
    yline = True
    
if xline and yline:
    print('Yes')
else:
    print('No')




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

using namespace std;


int main(){
    int n; cin >> n;
    int num, check = 0;
    while(n--){
        cin >> num;
        if(num%2 == 0 && num%3 && num%5) check = 1;
    }
    if(check == 1) cout << "DENIED\n";
    else cout << "APPROVED\n";
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		while(true){
			String s="";
			while(String.IsNullOrEmpty(s))s=Console.ReadLine();
			var d=s.Split(new char[1]{' '}, StringSplitOptions.RemoveEmptyEntries);
			if(d[0][0]=='0' && d[1][0]=='0')break;
			Sol mySol =new Sol(d);
			mySol.Solve();
		}
	}
}

class Sol{
	public void Solve(){
		
		int turn=0;
		int[][] M=new int[H][];
		Pair P=new Pair(-1,-1);
		for(int i=0;i<H;i++){
			M[i]=new int[W];
			for(int j=0;j<W;j++){
				M[i][j]=-1;
				if(Map[i][j]=='A')M[i][j]=turn;
				if(Map[i][j]=='B')P=new Pair(i,j);
			}
		}
		
		bool chk=true;
		HashSet<Pair> HL=new HashSet<Pair>();
		
		while(true){
			turn++;
			//まずAを進める
			for(int i=0;i<H;i++){
				for(int j=0;j<W;j++){
					if(M[i][j]==turn-1){
						if(i-1>=0 && Map[i-1][j]!='#' && M[i-1][j]==-1)M[i-1][j]=turn;
						if(i+1<H  && Map[i+1][j]!='#' && M[i+1][j]==-1)M[i+1][j]=turn;
						if(j-1>=0 && Map[i][j-1]!='#' && M[i][j-1]==-1)M[i][j-1]=turn;
						if(j+1<W  && Map[i][j+1]!='#' && M[i][j+1]==-1)M[i][j+1]=turn;
					}
				}
			}

			int move=(turn -1)%(Pat.Length);
			if(Pat[move]=='8'){if(P.R-1>=0)P.R-=1;}
			if(Pat[move]=='4'){if(P.C-1>=0)P.C-=1;}
			if(Pat[move]=='5'){;}
			if(Pat[move]=='6'){if(P.C+1<W)P.C+=1;}
			if(Pat[move]=='2'){if(P.R+1<H)P.R+=1;}
			if(M[P.R][P.C]!=-1)break;
			if(turn>H*W){
				//ループ停止条件：
				//turn>H*Wであれば、Aが行けるところにはすべてフラグが立っている
				//Bの動きの周期点をturn>H*W以降で観察すれば、Bがループに入ったかどうかが分かる。
				if(move==0){
					if(HL.Contains(P)){
						chk=false;
						break;
					}
					HL.Add(P);
				}
			}
		}
		
		if(!chk){
			Console.WriteLine("impossible");
			return;
		}
		
		Console.WriteLine("{0} {1} {2}",turn,P.R,P.C);
	}
	
	struct Pair{
		public int R;
		public int C;
		public Pair(int r,int c){
			R=r;C=c;
		}
	}
	
	
	
	int H;
	int W;
	String[] Map;
	String Pat;
	public Sol(String[] d_){
		H=int.Parse(d_[0]);W=int.Parse(d_[1]);
		Map=new String[H];
		for(int i=0;i<H;i++)Map[i]=rs();
		Pat=rs();
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {

    string a, b;
    cin>>a>>b;

    if(a.size()<b.size()) cout << "LESS" << endl;
    else if(a.size()>b.size()) cout << "GREATER" << endl;
    else{
        if(a<b) cout << "LESS" << endl;
        else if(a>b) cout << "GREATER" << endl;
        else cout << "EQUAL" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
//author: clorf
//Think twice,Code once.
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<ctime>
#define INF 1e9
using namespace std;
const int maxn=100010;
const double Pi=acos(-1.0);
template<class T>void read(T &x)
{
	x=0;int f=0;char ch=getchar();
	while(ch<'0'||ch>'9') {f|=(ch=='-');ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	x=f?-x:x;
	return;
}
int x;
int main()
{
	scanf("%d",&x);
	if(x>=30)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 1728
mod = 10 ** 9 + 7
n, k = map(int, input().split())
p = []
for _ in range(n-1):
    p.append(list(map(int, input().split())))
l = [[] for _ in range(n+1)]
for pi in p:
    l[pi[0]].append(pi[1])
    l[pi[1]].append(pi[0])

ans = k
from _collections import deque
q = deque()
q.append(1)

h = 0
done = [0] * (n+1)
done[1] = 1
while q:
    # print(q)
    r = q.popleft()
    h += 1
    if h <= 1:
        tmp = k-1
    else:
        tmp = k-2
    for s in l[r]:
        if done[s] == 0:
            q.append(s)
            done[s] = 1
            ans = (ans * tmp) % mod
            tmp -= 1
print(ans)

Measured memory_bytes: 79564
#関数リスト
import sys
from collections import defaultdict
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n = I()
mylist = LI()
q = I()
d = defaultdict(int)

for i in mylist:
    d[i] += 1
result = sum(mylist)

for i in range(q):
    pastN, nextN= MI()
    num = d[pastN]
    result += num * (nextN-pastN)
    print(result)
    d[pastN] = 0
    d[nextN] += num

Measured memory_bytes: 94504
def gcd(x, y):
    
    if x < y:
        x, y = y, x
    else:
        pass
    
    while y > 0:
        r = x % y
        x = y
        y = r

    return x
x, y = map(int, input().split())
result = gcd(x, y)
print(result)


Measured memory_bytes: 5600
#include<bits/stdc++.h>
using namespace std;
const int N=105;
int n,sc,a[N],ans,tot[N];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=n;i++) 
	  if (a[i]!=a[i-1]) tot[++sc]=1;
      else tot[sc]++;
    for (int i=1;i<=sc;i++) ans+=tot[i]/2;
    printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
use std::io;
fn main() {
    let mut x = String::new();
    io::stdin().read_line(&mut x).unwrap();
    let mut iter = x.trim().split_whitespace();
    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();
    let ans = if a < b {
        "a < b"
    } else if a > b {
        "a > b"
    } else {
        "a == b"
    };
    println!("{}", ans);
}


Measured memory_bytes: 5020
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main()
{
    long int A, B, K;
    cin >> A >> B >> K;

    if( K<=A ){
        cout << A - K << " " << B << endl;
    }else if( K <= A+B){
        cout << 0 << " " << B - (K - A) << endl;
    }
    else
    {
        cout << 0 << " " << 0 << endl;
    }

    return 0;
}

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

using ll = long long;
using db = double;
using pll = pair < ll, ll >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define pb push_back
#define mp make_pair
#define fastIo() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;

int main(){
	ll a, b, c, k; cin >> a >> b >> c >> k;
	ll sum = 0;
	while(k) {
		if(a && k) {
			ll picked = min(a, k);
			sum += picked * 1;
			a -= picked;
			k -= picked;
		} else if(b && k) {
			ll picked = min(b, k);
			b -= picked;
			k -= picked;
		} else if(c && k) {
			ll picked = min(c, k);
			sum += -1 * picked;
			c -= picked;
			k -= picked;
		}
		trace(sum);
	}
	cout << sum << endl;
}

Measured memory_bytes: 3644
fun main(args: Array<String>) {
    val a = "AKIHABARA"
    val used = Array(a.length) {false}
    val b = readLine()!!
    var ai = 0
    var bi = 0
    while (ai < a.length && bi < b.length) {
        if (a[ai] == b[bi]) {
            used[ai] = true
            ai++
            bi++
        } else {
            ai++
        }
    }
    val onlyA = a.filterIndexed { idx, c -> !used[idx] }.any { it != 'A' }.not()
    println(if (bi == b.length && onlyA) "YES" else "NO")
}

Measured memory_bytes: 33776
#include <bits/stdc++.h>
#include <fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>


typedef  long long ll;
typedef long double ld;
using namespace std;
using namespace __gnu_pbds;


#define endl "\n"
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
const int N=5e5+5;
int mod=1e9+7;

ll mul (ll a, ll b)
{
    a%=mod;
    b%=mod;
    return (a*b)%mod;
}
ll add (ll a, ll b)
{
    a%=mod;
    b%=mod;
    return (a+b+mod)%mod;
}
ll fastpow(ll b, ll p)
{
    if(p==0)
        return 1;
    ll ans=fastpow(b,p/2);
    ans=mul(ans,ans);
    if(p%2)ans=mul(ans,b);
    return ans;
}

vector<int>v[N];
ll ans=1;
ll n,k;
bool vist[N];

void dfs(int x,ll co)
{
    if (vist[x])
    return ;
    vist[x]=1;
    ans=mul(ans,co);
    ll c=k-2;
    for(int i=0;i<v[x].size();i++)
    {
        if(!vist[v[x][i]])
            dfs(v[x][i],c--);
    }

}


int main()
{
    FIO
    int root=0;
    cin>>n>>k;
    for(int i=0;i<n-1;i++)
    {
        int a,b;
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    int co=0;
    for(int i=1;i<=n;i++)
    {
        if(v[i].size()>co)
            co=v[i].size(),root=i;
    }
    ans=mul(ans,k);
    ll c=k-1;
    vist[root]=1;
    for(int i=0;i<v[root].size();i++)
    {
                if(!vist[v[root][i]])
                    dfs(v[root][i],c--);



    }

    cout<<ans;
    return 0;
}


Measured memory_bytes: 22052
import java.util.*;

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

        int n = sc.nextInt();
        int t = sc.nextInt();
        int a = sc.nextInt();

        int[] h = new int[n];
        for (int i = 0; sc.hasNextInt(); i++) {
            h[i] = sc.nextInt();
        }

        int maxIndex = 0;
        double val = Math.abs(a - ave(t, h[0]));
        for (int i = 1; i < h.length; i++) {
            double target = Math.abs(a - ave(t, h[i]));
            if (val > target) {
                maxIndex = i;
                val = target;
            }
        }

        System.out.println(maxIndex + 1);
    }

    static double ave(int t, int h) {
        return t - (h * 0.006);
    }
}

Measured memory_bytes: 24292
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

int prime[1000010];
bool is_prime[1000010];
void sieve(int n){
    int p = 0;
    for(int i = 0; i <= n; i++) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i <= n; i++){
        if(is_prime[i]){
            prime[p++] = i;
            for(int j = 2*i; j <= n; j += i) is_prime[j] = false;
        }
    }
}

signed main(){
    sieve(1000000);
    int n;
    while(cin >> n){
        int ans = 0;
        rep(i, 2, n + 1){
            if(is_prime[i]) ans++;
        }
        cout << ans << endl;
    }
}

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

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void test_case() {
	
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	long long a, b, c, d;
	cin >> a >> b >> c >> d;
	long long ans = a * c;
	ans = max(ans, a * d);
	ans = max(ans, b * c);
	ans = max(ans, b * d);
	cout << ans;
	return 0;
}



Measured memory_bytes: 3644
#include <stdio.h>

int main(void)
{
    int a[3];
    scanf("%d %d %d", &a[0], &a[1], &a[2]);
    int d1,d2;
    if(a[0]>=a[1]){
        if(a[0]>=a[2])d1 = a[0];
        else d1 = a[2];
    } 
    else if(a[1]>=a[2])d1 = a[1];
    else d1 = a[2];
    if(a[0]<=a[1]){
        if(a[0]<=a[2])d2 = a[0];
        else d2 = a[2];
    } 
    else if(a[1]<=a[2])d2 = a[1];
    else d2 = a[2];
    printf("%d", d1-d2);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
 
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 1e9
// #define ll long long ll
 
typedef long long ll;
ll mod = 1e9 + 7;
 long long fast_exp(long long a, long long b)
{
    if(b <= 0)
       return 1;
    else
    {
       long long res = 1;
       res = fast_exp(a,b/2);
       res = (res*res)%mod;
       if(b%2 == 1)
          res = (res*a)%mod;
       return res;
 
    }
}


typedef long double ld;

int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    int n, k, c;
    cin >> n >> k >> c;
    int till[n+2*(c+1)]={}, after[n+2*(c+1)]={};
    string s, cur;
    cin >> cur;
    for(int i = 0; i<c+1 ; i++)
        s+='x';

    s+=cur;
    for(int i = 0; i<c+1 ; i++)
        s+='x';
    int sz = s.size();
    for(int i = c+1; i<sz ; i++)
    {
       if(s[i] == 'o') 
            till[i] = max(till[i],till[i-c-1] + 1);
        till[i] = max(till[i],till[i-1]);   
    }
    //cout << s << endl;
    //  for(int i = 0; i<sz ; i++)
    //     cout << s[i] << ' ';
    // // cout << endl;
    for(int i = sz - 1- (c+1); i>=0 ; i--)
    {
       if(s[i] == 'o')
            after[i] = max(after[i],after[i+c+1]+1);
        after[i] = max(after[i+1],after[i]);
    }
    // cout << endl;
    // for(int i = 0; i<sz ; i++)
    //     cout << s[i] << ' ';
    // cout << endl;
    // for(int i = 0; i<sz ; i++)
    //     cout << after[i] << ' ';
    int ans[n+2*(c+1)] = {};
    // ans[0] = 1;
    // ans[c+1] = -1;
    // ans[sz-(c+1)] = 1;
    
    for(int i = -1; i<sz-1; i++)
    {
        int l = i, r = i + max(c + 1,2);
        int lval, rval;
        if(l == -1)
            lval = 0;
        else
            lval = till[l];
        if(r >= sz)
            rval = 0;
        else
            rval = after[r];

        if(lval + rval >= k)
        {
            //cout << "satisfied : "<< " l : "<<l <<" r: "<<r<<endl;
            if(l+1 >= 0)
            {   
                ans[l+1] += 1;
                if(r < sz)
                    ans[r] += -1;
            }
        }

    }
    int sum = 0;
    vector <int> out;
    for(int i = 0; i<sz-(c+1) ; i++)
    {
        sum+=ans[i];
        //cout << "sum : " << sum <<endl;
        if(sum == 0 && i >= c+1 && i < sz - (c+1) )
            out.pb(i-c);
    }
    //cout << '\n' << out.size() <<'\n';
    for(auto e : out)
        cout << e << endl;

    



         





    return 0;
 
 
}

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

using namespace std;

typedef short sho;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str; 
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll; 
typedef pair<ld,ld> pld;
 
typedef vector<int> vi; 
typedef vector<ll> vl; 
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pld> vpd;

#define LOCAL
#define MP make_pair 
#define FF first
#define SS second
#define sz(x) (int)x.size()
#define begin(x) (x).begin() 
#define end(x) (x).end()
#define rbegin(x) (x).rbegin()
#define rend(x) (x).rend()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define PF push_front 
#define PB push_back
#define PP push
#define lb lower_bound 
#define ub upper_bound
#define lowbit(x) x&(-x)
#define testbit(x,i) x&(1<<i)

inline void checkmin(int &x,int y){x=min(x,y);}
inline void checkmax(int &x,int y){x=max(x,y);}

str s;

int main() 
{
	#ifndef LOCAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /* start code */
    cin>>s;
    if(s[0] == '7' || s[1] == '7' || s[2] == '7') cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    /* end code */
	return 0;
}

Measured memory_bytes: 3612
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn coll() -> Vec<char> {
    (read::<String>().chars().rev().collect())
}

fn main() {
    let mut a: Vec<char> = coll();
    let mut b: Vec<char> = coll();
    let mut c: Vec<char> = coll();

    let mut turn: char = 'a';

    loop {
        match turn {
            'a' => if let Some(card) = a.pop() { turn = card } else { break },
            'b' => if let Some(card) = b.pop() { turn = card } else { break },
            'c' => if let Some(card) = c.pop() { turn = card } else { break },
            _ => panic!(),
        }
    }

    println!("{}", match turn {
        'a' => 'A',
        'b' => 'B',
        'c' => 'C',
        _ => panic!(),
    });
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

ll calc(vector<int> &v, int bit)
{
    ll ret = 0;
    ll tmp = v[0];
    rep(i, v.size() - 1)
    {
        if (((bit >> i) & 1) == 1)
        {
            ret += tmp;
            tmp = v[i + 1];
        }
        else
        {
            tmp *= 10;
            tmp += v[i + 1];
        }
    }
    ret += tmp;
    return ret;
}

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    vector<int> v(s.size());
    ll ans = 0;
    rep(i, s.size())
    {
        v[i] = s[i] - '0';
    }
    rep(i, (1 << (v.size() - 1)))
    {
        ans += calc(v, i);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
B = [pow(6,i) for i in range(1,10) if pow(6,i)<=N]
C = [pow(9,i) for i in range(1,10) if pow(9,i)<=N]
A = sorted(B+C+[1])
L = len(A)
DP = [[N]*(N+1) for i in range(L)]
DP[0] = [i for i in range(N+1)]
for l in range(1,L):
    k = A[l]
    for n in range(0,k):
        DP[l][n] = DP[l-1][n]
    for n in range(k,N+1):
        DP[l][n] = min(DP[l-1][n-k]+1,DP[l][n-k]+1,DP[l-1][n])
print(DP[L-1][N])

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

#define for_(i,a,b) for(int i=a;i<b;++i)

int main() {
	int N, K, x, y, M, col[3] = {1, 2, 3};
	cin >> N >> K;
	M = N / 2;
	
	for_(i,0,K) {
		cin >> x >> y;
		
		x = (x > M) ? N - x + 1 : x;
		y = (y > M) ? N - y + 1 : y;
		
		--x; --y;
		cout << (x < y ? col[x % 3] : col[y % 3]) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main() {

  int a,b,i,j,A[10000],B[500],count=0;

  scanf("%d",&a);
  for(i = 0; i < a; i++) {
    scanf("%d",&A[i]);
      }
  scanf("%d",&b);
  for(i = 0; i < b; i++) {
    scanf("%d",&B[i]);
      }

  
  for(i = 0; i < b; i++) {
    for(j = 0; j < a; j++){
      if(B[i] == A[j]) {
	count++;
	break;
      }
    }
  }

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



Measured memory_bytes: 2048