akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
// import java.util.Arrays;
// import java.util.StringTokenizer;

// import java.util.Stack;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {


        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));

        int MOD = (int) (Math.pow(10, 9)) + 7;

        StringTokenizer st = new StringTokenizer(f.readLine());
        int H = Integer.parseInt(st.nextToken());
        int W = Integer.parseInt(st.nextToken());


        int[][] grid = new int[H][W];

        grid[0][0] = 1;

        for (int i = 0; i < H; i++) {
            String s = f.readLine();
            for (int j = 0; j < W; j++) {
                if (s.charAt(j) == '#') {
                    grid[i][j] = 0; // actually don't need to do anything
                }
                else if (i == 0 && j == 0) {

                }
                else if (i == 0) {
                    grid[i][j] = grid[i][j-1];
                }else if (j == 0) {
                    grid[i][j] = grid[i-1][j];
                }
                else {
                    grid[i][j] = (grid[i-1][j] + grid[i][j-1]) % MOD;
                }
            }
        }

        /* for (int[] i : grid){
            for (int j : i){
                System.out.print(String.valueOf(j) + " ");
            }
            System.out.println();
        } */
        System.out.println(grid[H-1][W-1]);

    }
}

Measured memory_bytes: 30468
//Catchharsh
    //I Luv Kunj017
    #include<bits/stdc++.h>
    #define ll long long int 
    #define ld long double
    #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define F first
    #define S second
    #define pb push_back
    #define endl '\n'
    const ll MOD = 998244353;
    const ll INF = 1011111111;
    const ll LLINF = 1000111000111000111LL;
    const ld EPS = 1e-10;
    const ld PI = 3.14159265358979323;
    using namespace std;
    ll power (int x,int n)
    {
        if(n==0)
        return 1;
        else if(n%2==0)
        return power((x*x),n/2);
        else
        return x*power((x*x),(n-1)/2); 
    }
    vector<ll> seve;
    void  seveprime()
    {
      int prime[1000000]={0};
      for(int i=2;i*i<1000000;i++)
       {
        if(prime[i]==0)
         {
          for(int j=i*2;j<=1000000;j+=i)
           prime[j]=1;
         }
       }
       for(int i=2;i<=1000000;i++)
       {
         if(prime[i]==0)
           seve.pb(i);
       }
    }
    int main()
    {   
         IOS;
         ll n,m,i,j,k;
         cin>>n>>i>>j;
         cout<<min(n*i,j);
    }

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

int main(){
	string str[8];

	bool x[8][8];
	
	while(cin >> str[0]){
		for(int i=1;i<8;i++){
			cin >> str[i];
		}
		
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(str[i][j]=='1'){
					x[i][j]=1;
				}else{
					x[i][j]=0;
				}
			}
		}

		bool flag = 0;
		
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(x[i][j]){
					if(!flag && j<5){
						if(x[i][j+1] && x[i][j+2] && x[i][j+3]){
							cout << "C" << endl;
							flag = 1;
						}
					}
					if(!flag && j<7){
						if(x[i][j+1]){
							if(x[i+1][j] && x[i+1][j+1]){
								cout << "A" << endl;
								flag = 1;
							}
							else if(j<6 && x[i+1][j+1] && x[i+1][j+1]){
								cout << "E" << endl;
								flag = 1;
							}
							else if(j>0 && x[i+1][j-1] && x[i+1][j]){
								cout << "G" << endl;
								flag = 1;
							}
						}
					}
					if(!flag && i<6){
						if(x[i+1][j]){
							if(j<7 && x[i+1][j+1] && x[i+2][j+1]){
								cout << "F" << endl;
								flag = 1;
							}
							else if(j>0 && x[i+1][j-1] && x[i+2][j-1]){
								cout << "D" << endl;
								flag = 1;
							}
							else if(i<5 && x[i+2][j] && x[i+3][j]){
								cout << "B" << endl;
								flag = 1;
							}
						}
					}
					if(flag){
						i=10;j=10;
					}
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1184
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
int main(){
	int h,w,x,y,data[52][52],flag[52][52]={0};
	cin>>h>>w;
	char cc;
	for(int i=0;i<52;i++)for(int j=0;j<52;j++)data[j][i]=9999;
	for(int i=0;i<52;i++)flag[i][0]=flag[0][i]=1;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin>>cc;
			data[j][i]=cc-'0';
		}
	}
	queue<int>X;
	queue<int>Y;
	X.push(w);
	Y.push(h);
	while(X.empty()==0){
		x=X.front();
		y=Y.front();
		if(flag[x][y]==0){
			flag[x][y]=1;
			if(x!=w||y!=h)data[x][y]+=min(data[x+1][y],data[x][y+1]);
			X.push(x);
			Y.push(y-1);
			X.push(x-1);
			Y.push(y);
		}
		X.pop();
		Y.pop();
	}
	cout<<data[1][1]<<endl;
	return 0;
}


Measured memory_bytes: 1240
import math,sys,bisect,heapq
from collections import defaultdict,Counter,deque
from itertools import groupby,accumulate
#sys.setrecursionlimit(200000000)
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda: map(int,input().split())
alele = lambda: list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
#def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
MOD = 1000000000 + 7
def Y(c):  print(["NO","YES"][c])
def y(c):  print(["no","yes"][c])
def Yy(c):  print(["No","Yes"][c])

    
def fun(A,N):
    dp = list2d(3000,3000,0)
    dp[0][0] = 1 - A[0]
    dp[0][1] = A[0]
    for i in range(1,N):
        for j in range(3000):
            #tails
            dp[i][j] += (1-A[i])*dp[i-1][j]
            #heads
            if j > 0:
                dp[i][j] += A[i]*(dp[i-1][j-1])
    ans = 0
    for i in range(N//2 + 1,3000):
        ans += dp[N-1][i]
    return ans
        
N = int(input())
A = list(map(float, input().split()))
print(fun(A,N))

Measured memory_bytes: 200284
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#define BUFSIZE 1000000

int N,K;
int  hoge[BUFSIZE]={0};
long long V,W,T;
int count = 0;
int x;
int p[BUFSIZE] = {0};



int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}



int main(void){

  scanf("%d %d",&N,&K);
  for(int i = 0; i < N; i++){
    scanf("%d",&p[i]);
  }
  qsort(p,N,sizeof(int),compare_int);

  for(int i = 0;i < K;i++){
        count = count+p[i];
      }
      printf("%d",count);
  return 0;

}


Measured memory_bytes: 1752
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

const int N=100000;
int a[N]; 

int main(){
	int n;
	cin >> n;
	while(n--){
		int m;
		cin >> m;
		a[m]++;
		a[m-1]++;
		a[m+1]++; 
	} 
	int max=0;
	for(int i=0;i<N;i++){
		if(a[i]>max){
			max=a[i];
		}
	}
	cout << max <<endl;
	return 0;
}

Measured memory_bytes: 3484
import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int p = sc.nextInt();
    
    for(int x=0 ; x<=n ; x++){
      for(int y=0 ; y<=(n-x); y++){
         int z=n-x-y;
          
          int total = 10000*x + 5000*y + 1000*z;
          if(p==total){
            System.out.print(x+" "+y+" "+z);
            return;
          }
      }
    }
    System.out.println("-1 -1 -1");
  }
}       

Measured memory_bytes: 23760
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MOD 1000000007
#define PI 3.141592653589793

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << a + b + c - max({a, b, c}) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,maxv=-1;
	cin>>n;
	string a[n+1];
	map<string,int> ma;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		ma[a[i]]++;
		maxv=max(maxv,ma[a[i]]);
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;++i){
		if(ma[a[i]]==maxv&&a[i]!=a[i-1]) cout<<a[i]<<endl;
	}
	return 0;
}

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

int main(void) {
    int K, a, b, i;
    scanf("%d %d %d", &K, &a, &b);
    for(i = a; i <= b; i++) {
        if(i % K == 0) {
            printf("OK\n");
            return 0;
        }

    }
    printf("NG\n");
    return 0;
}

Measured memory_bytes: 2064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL<<60;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP2(i,m,n) for(int i=m;i<n;i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
static const double pi = 3.14159265358979323846;

int main(){
    ll a,b,h,m;
    cin >> a>>b>> h>>m;
    
    double hour=(h*60+m)/360.0*pi;
    double min = m/30.0*pi;
    double theta;
    
    

    if(min>hour){
        theta=(min-hour);
    }else{
        theta=(hour-min);
    }
    
    // cout<<theta<<endl;;
    double ans = a*a+b*b -2*a*b*cosl((theta));
    ans = sqrtl(ans);
    
    // cout<<cos(theta*pi)<<endl;
    cout<<std::setprecision(20)<<ans<<endl;
    

}


Measured memory_bytes: 4132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n;
    cin >> n;
    bool judge=false;
    for(ll i=0;i<n;i++){
        ll a;
        cin >> a;
        if(a%2==1) judge=true;
    }
    if(judge)cout << "first" << endl;
    else cout << "second" << endl;
}


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

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

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int A,B;
  cin>>A>>B;
  if(A<10&&B<10) cout<<A*B<<endl;
  else cout<<-1<<endl;
}

Measured memory_bytes: 3636
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int R = in.Int();
            String ans = "AGC";
            if (R < 1200) {
                ans = "ABC";
            } else if (R < 2800) {
                ans = "ARC";
            }
            out.println(ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21332
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<tgmath.h>
#include<stdbool.h>
#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

const int INF = 1001001001;
int h, n, a[1111], b[1111], c[11111];

main(){
    for(int i=1; i<11111; i++)c[i] = INF;
    scanf("%d%d", &h, &n);
    for(int i=0; i<n; i++)scanf("%d%d", &a[i], &b[i]);
    for(int i=0; i<h; i++){
        for(int j=0; j<n; j++){
            c[min(h, i+a[j])] = min(c[min(h, i+a[j])], c[i] + b[j]);
        }
    }
    printf("%d\n", c[h]);
    return 0;
}

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

namespace agc003_a
{
    class Program
    {
        static void Main(string[] args)
        {
            List<char> input = Console.ReadLine().ToCharArray().ToList();

            List<char> n = input.Where(x => x == 'N').ToList();
            List<char> s = input.Where(x => x == 'S').ToList();
            List<char> e = input.Where(x => x == 'E').ToList();
            List<char> w = input.Where(x => x == 'W').ToList();

            string result = "No";

            if (n.Count > 0 && s.Count > 0 && e.Count > 0 && w.Count > 0)
            {
                result = "Yes";
            }

            if (n.Count > 0 && s.Count > 0 && (e.Count == 0 && w.Count == 0))
            {
                result = "Yes";
            }


            if ((n.Count == 0 && s.Count == 0) && e.Count > 0 && w.Count > 0)
            {
                result = "Yes";
            }



            Console.WriteLine(result);

        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)

int main()
{int n;cin>>n;
 int k[20];
 rep(i,n) cin>>k[i];
 sort(k,k+n);
 int sum=0;
 rep(i,n)
 {if (i==n-1)
 {sum += k[i]/2;
 }
  else
  {
    sum += k[i];
  }
 }
 cout<<sum<<endl;
 return 0;
}


Measured memory_bytes: 256
n, *AB = map(int, open(0).read().split())
a = sorted(AB[::2])
b = sorted(AB[1::2])
is_odds = n % 2 == 0
if n % 2 == 0:
	print(b[n // 2 - 1] + b[n // 2] - a[n // 2 - 1] - a[n // 2] + 1)
else:
	print(b[(n + 1) // 2 - 1] - a[(n + 1) // 2 - 1] + 1)

Measured memory_bytes: 55376
#include<iostream>
#include<cstdio>
#include<cctype>
using namespace std;
int main()
{
	char ch;
	int a[26]={0};
	char b[26]={'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'};
	
	while( cin >> ch )
	{
		ch = tolower(ch);
		if ( isalpha(ch) )
		{
			a[ch - 'a']++;
		}
	}

	for( int i=0; i<26; i++)
	{
		cout << b[i] <<  ' ' << ':' << ' ' << a[i] << endl;
	}
	return 0;
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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 GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

void printv(vector<long long> &v)
{
  for (int i = 0; i < v.size(); i++)
  {
    cout << v[i];
    if (i != v.size())
      cout << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int a,b,q; cin>>a>>b>>q;
  vector<ll> S(a+2), T(b+2), X(q);
  rep(i,a+1){
    if(i==0)S[i]=-LINF;
    else cin>>S[i];
  }
  rep(i,b+1){
    if(i==0)T[i]=-LINF;
    else cin>>T[i];
  }
  S[a+1]=T[b+1]=LINF;
  rep(i,q)cin>>X[i];
  
  // printv(S);
  // printv(T);
  // printv(X);
  
  rep(i,q){
    ll x=X[i];
    ll s=lower_bound(S.begin(),S.end(),x)-S.begin();
    ll t=lower_bound(T.begin(),T.end(),x)-T.begin();
    ll ans=LINF;
    // cout<<s<<" "<<t<<endl;
    // cout<<x<<" "<<S[s]<<" "<<T[t]<<endl;
    chmin(ans,abs(S[s]-x)+abs(T[t-1]-x)*2);
    chmin(ans,abs(S[s]-x)*2+abs(T[t-1]-x));
    chmin(ans,abs(S[s-1]-x)+abs(T[t]-x)*2);
    chmin(ans,abs(S[s-1]-x)*2+abs(T[t]-x));
    chmin(ans,max(S[s]-x,T[t]-x));
    chmin(ans,max(x-S[s-1],x-T[t-1]));
    // cout<<abs(S[s]-x)+abs(T[t-1]-x)<<" "<<abs(S[s-1]-x)+abs(T[t]-x)<<" "<<max(S[s]-x,T[t]-x)<<" "<<max(x-S[s-1],x-T[t-1])<<" ";
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;

ll fastPow(ll x, ll n)
{
    if (n == 0)
        return 1;
    if (n % 2 == 0)
        return fastPow(x * x % MOD, n / 2);
    else
        return x * fastPow(x, n - 1) % MOD;
}

ll modDiv(ll a, ll b)
{
    return a * fastPow(b, MOD - 2) % MOD;
}

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

    int n;
    ll all, res, p[112345];
    cin >> n;

    all = 1;
    REP(i, n)
    {
        all *= (i + 1);
        all %= MOD;
    }

    p[0] = 0;
    p[1] = 1;
    REP(i, n + 10)
    {
        p[i + 2] = p[i + 1] + modDiv(1, i + 2);
        p[i + 2] %= MOD;
    }

    res = 0;

    REP(i, n)
    {
        ll a;
        cin >> a;

        res += a * (p[n - (i + 1) + 1] + p[(i + 1)] - 1) % MOD;
        res %= MOD;
    }

    res *= all;
    res %= MOD;

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    { 
        static void Main(string[] args)
        {
            string[] s =Console.ReadLine().Split(' ');

            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);
            int c = int.Parse(s[2]);
            int temp=0;

            if (a > b)
            {
                temp = b;
                b = a;
                a = temp;
            }
            if (b > c)
            {
                temp = c;
                c = b;
                b = temp;
            }
            if(a > b)
            {
                temp = b;
                b = a;
                a = temp;
            }

            Console.WriteLine(a+" "+b+" "+c);
            //int n =int.Parse(s);
        }
    }
}

Measured memory_bytes: 7660
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
    int N, P;
    cin >> N >> P;
    int odds = 0, evens = 0, tmp;
    long long evens_x = 0, odds_x = 0;

    for (int i = 0; i < N; i++) {
        cin >> tmp;
        if (tmp % 2 == 0) evens++;
        else odds++;
    }

    evens_x = (long long)pow(2, evens);

    if (odds == 0 && P == 0) {
        cout << (long long)(evens_x) << endl;
    } else if (odds == 0 && P == 1) {
        cout << 0 << endl;
    } else {
        odds_x = (long long)pow(2, odds - 1);

        cout << (long long)(evens_x * odds_x) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
const ll MOD = 1e9+7;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
#define fs first
#define sc second


const int INF = 1e9;
const ll LLINF = 1e16;

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 U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
template<typename T>
T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T>
T ngcd(vector<T> a){
    T res;
    res = a[0];
    for(int i = 1; i < a.size() && res != 1; i++) {
        res = gcd(a[i], res);
    }
    return res;
}
 
template<typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

template<typename T>
T nlcm(vector<T> numbers) {
    T res;
    res = numbers[0];
    for (int i = 1; i < numbers.size(); i++) {
        res = lcm(res, numbers[i]);
    }
    return res;
}

// 割り算の切り上げ処理
template<typename T>
T round_up(T a, T b) {
  return (a + b - 1) / b;
}

// 約数列挙
template<typename T>
vector<T> calc_divisor(T n) {
   vector<T> res;
   for (T i = 1LL; i*i <= n; ++i) {
       if (n % i == 0) {
           res.push_back(i);
           T j = n / i;
           if (j != i) res.push_back(j);
       }
   }
   sort(res.begin(), res.end());
   return res;
}

// 素数判定
template<typename T>
bool isPrime(T x){
    T i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


using pint = pair<int, int>;
using pll = pair<ll, ll>;

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




int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    string ans[] = {"Sunny", "Cloudy", "Rainy"};
    string s;
    cin >> s;
    rep(i,3) {
        if(s == ans[i] && i != 2) print(ans[i + 1]);
        else if(s == ans[i]) print(ans[0]);
    }
}


Measured memory_bytes: 256
using System;

class Program
{
    static void Main()
    {
        while (true)
        {
            string[] a = Console.ReadLine().Split(' ');
            if(a[0]=="0"&&a[1]=="0")break;
            int[] b =new int[2];
            for (int i = 0; i < 2; i++)
            {
                b[i] = int.Parse(a[i]);
            }
            Array.Sort(b);
            Console.WriteLine("{0} {1}", b[0], b[1]);
        }
    }
}

Measured memory_bytes: 5904
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  ll n;
  cin >> n;
  vector<ll> a(n);
  map<ll, ll> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }

  string ans = "No";
  if (n % 3 == 0) {
    if (m.size() > 3) {
      ans = "No";
    } else if (m.size() == 3) {
      bool ok = true;
      ll t = 0;
      for (auto p : m) {
        ll v = p.first;
        ll cnt = p.second;
        if (cnt != n / 3) {
          ok = false;
          break;
        }
        t ^= v;
      }

      if (t != 0) {
        ok = false;
      }

      ans = ok ? "Yes" : "No";
    } else if (m.size() == 2) {
      ans = m[0] == n / 3 ? "Yes" : "No";
    } else {
      ans = m.find(0) != m.end() ? "Yes" : "No";
    }
  } else {
    bool ok = true;
    for (int i = 0; i < n; i++) {
      if (a[i] != 0) {
        ok = false;
        break;
      }
    }
    ans = ok ? "Yes" : "No";
  }

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 5760
#include<stdio.h>
#include<string.h>
int main(){
	int n,i,j,ans;
	char k[25],s[25];
	FILE *fp;
	//fp=fopen("test.txt","r");
	fp=stdin;
	fscanf(fp,"%s%d",k,&n);
	ans=0;
	while(n--){
		fscanf(fp,"%s",s);
		for(i=0;i<10;i++){
			for(j=0;j<strlen(k);j++){
				if(s[(i+j)%10]!=k[j])break;
			}
			if(j==strlen(k)){
				ans++;
				break;
			}
		}
	}
	printf("%d\n",ans);
	fclose(fp);
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>

#define MAX 100000

int parent(int i){return i/2;}
int left(int i){return i*2;}
int right(int i){return i*2+1;}


int main(){
int H,i,A[MAX+1];


  scanf("%d",&H);
  for(i=1;i<=H;i++){
scanf("%d",&A[i]);
  }

for(i=1;i<=H;i++){
printf("node %d: key = %d, ",i,A[i]);
if(parent(i)>=1)printf("parent key = %d, ",A[parent(i)]);
if(left(i)<=H)printf("left key = %d, ",A[left(i)]);
if(right(i)<=H)printf("right key = %d, ",A[right(i)]);
printf("\n");
}
return 0;
}

Measured memory_bytes: 608
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] a = new int[3];
        a[0] = scanner.nextInt();
        a[1] = scanner.nextInt();
        a[2] = scanner.nextInt();
        Arrays.sort(a);
        System.out.printf("%d %d %d\n", a[0], a[1], a[2]);
        scanner.close();
    }
}



Measured memory_bytes: 26460
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int N, A, B, C, D;
int main() {
	ios::sync_with_stdio(false);
	cin >> N >> A >> B >> C >> D;
	bool f = false;
	for (int i = 0; i < N; i++) {
		long long l = 1LL * i * C - 1LL * (N - i - 1) * D, r = 1LL * i * D - 1LL * (N - i - 1) * C;
		if (l <= B - A && B - A <= r) f = true;
	}
	cout << (f ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  char b;
  scanf("%c", &b);

  if (b == 'A') {
    printf("T\n");
  }
  if (b == 'C') {
    printf("G\n");
  }
  if (b == 'G') {
    printf("C\n");
  }
  if (b == 'T') {
    printf("A\n");
  }

  return 0;
}

Measured memory_bytes: 128
from itertools import accumulate
from bisect import bisect, bisect_left
from collections import Counter, deque
from functools import reduce
from itertools import accumulate
from operator import itemgetter, xor
from heapq import heappop, heappush

from sys import setrecursionlimit
setrecursionlimit(10**9)
 
import sys
input = sys.stdin.readline
from collections import Counter
def inpl(): return list(map(int, input().split()))

N, M = inpl()
T = sorted([inpl() for _ in range(N)], key=itemgetter(0), reverse=True)
Q = []
ans = 0

for i in range(1, M+1):
    while len(T) and (T[-1][0] == i):
        heappush(Q, -T.pop()[1])
    if len(Q):
        ans += -heappop(Q)

print(ans)

Measured memory_bytes: 74204
N  = int(input())
B = list(map(int, input().split()))
A = []

for i in range(N-1):
  if i == 0:
    A.append(B[i])
  elif B[i - 1] <= B[i]:
    A.append(B[i - 1])
  else:
    A.append(B[i])
if A[-1] <= B[N-2]:
  A.append(B[N-2])
else:
  A.append(A[-1])
print(sum(A))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n,d,x;
  cin>>n>>d>>x;
  vin a(n);
  rep(i,0,n)cin>>a[i];
  int ans=0;
  rep(i,0,n){
    ans++;
    int day=1;
    while(day+a[i]<=d){
      day+=a[i];
      ans++;
    }
  }
  cout<<ans+x<<endl;
}

Measured memory_bytes: 3624
function Main(input) {
    var tmp = input.split(" ");
    var L = parseInt(input,10);
    

    //-input
    //L=正の整数

    //-output
    //L=x+y+zを満たす直方体の体積S=x*y*z

    console.log(Math.pow(+L/3,3));



}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));




Measured memory_bytes: 7372
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	if (SZ(S) == 3) {
		rev(S);
	}
	cout << S << endl;
	PAU;
	return 0;
}


Measured memory_bytes: 504
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int n=in.nextInt(),s=0;
		int k=in.nextInt();
		int arr[]=new int[k];
		for(int i=0;i<k;i++)
		{
			arr[i]=in.nextInt();
			s=s+arr[i];
		}
		if(s>=n)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 50480
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

int main()
{
    int N;
    cin >> N;

    int A[N+10], B[N+10], C[N+10];
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    rep(i,N-1) cin >> C[i];
    A[N] = 0;
    C[N-1] = 0;

    int ans = 0;
    rep(i,N) ans += B[i];

    rep(i,N)
    {
        if (A[i+1] == A[i]+1) ans += C[A[i]-1];
    }
    cout << ans << endl;
}   

Measured memory_bytes: 256
#include <stdio.h>
#define swap(type, x, y) do{ type t = x; x = y; y = t; }while(0)

void quick(int array[], int left, int right){
  int pl = left, pr = right, x = array[(left + right) / 2];
  do{
    while(array[pl] < x)  pl++;
    while(array[pr] > x)  pr--;
    if(pl <= pr){
      swap(int, array[pl], array[pr]);
      pl++, pr--;
    }
  }while(pl <= pr);
  if(pl < right)  quick(array, pl, right);
  if(pr > left)  quick(array, left, pr);
}

int main(){
  int n;  scanf("%d", &n);
  int a[100002];
  for(int i=0; i<n; i++)  scanf("%d", &a[i]);

  quick(a, 0, n-1);

  int ans = a[n/2] - a[n/2-1];
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define mx 1000000007
#define F first //コスト
#define SF second.first //始め
#define SS second.second //終わり
typedef pair<int,int> P;
typedef pair<int,P> PP;
int main()
{
	int n,m,s;
	int a,b,c;
	int i,j;
	
	PP p[100000];
	
	cin>>n>>m;
	int d[n];
	
	for(i=0;i<m;i++){
		cin>>a>>b>>c;
		p[i]=PP(c,P(a,b));	
	}
	
	sort(p,p+m);

	
	int leng[10000],par[10000];
	for(i=0;i<n;i++){
		leng[i]=1; par[i]=i; d[i]=mx;
	}
	d[s]=0;
	
	int sum=0,x,y;
	for(i=0;i<m;i++){
	
		d[p[i].SS]=min(d[p[i].SS],d[p[i].SF]+p[i].F);
		
		x=p[i].SF;
		while(x!=par[x]) x=par[x];
		
		y=p[i].SS;
		while(y!=par[y]) y=par[y];
		
		
		if(x==y) continue;
		
		else {
			if(leng[x]>leng[y]) par[y]=x;
			
			else if(leng[x]<leng[y]) par[x]=y;
			
			else {par[y]=x,leng[x]++;}
			sum+=p[i].F;
		}
	}
	
	cout<<sum<<endl;
	
	return 0;
}	


Measured memory_bytes: 4400
#include <stdio.h>
int main(void){
    int x,h,m,s;
    scanf("%d",&x);
    h=x/3600;
    m=(x-h*3600)/60;
    s=(x-h*3600-m*60);
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}

Measured memory_bytes: 2716
X = int(input())
 
flag = 0
A = 0
B = 0
 
for i in range(-120, 120):
  for j in range(-120, 120):
    if i**5 - j**5 == X:
      A = i
      B = j
      break
    elif i**5 + j**5 == X:
      A = i
      B = -j
      break
    elif -i**5 - j**5 == X:
      A = -i
      B = j
      break
print(str(A) + ' ' + str(B))

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

int N;
using Point = std::complex<long double>;
std::vector<Point> xy;
long double eps{1e-7};

Point Circumcenter(Point a, Point b, Point c) {

	//辺
	long double eAB = std::abs(b - a);
	long double eBC = std::abs(c - b);
	long double eCA = std::abs(a - c);

	//角度(余弦定理)
	long double aCAB = std::acos((eCA*eCA + eAB*eAB - eBC*eBC) / (2 * eCA*eAB));
	long double aABC = std::acos((eAB*eAB + eBC*eBC - eCA*eCA) / (2 * eAB*eBC));
	long double aBCA = std::acos((eBC*eBC + eCA*eCA - eAB*eAB) / (2 * eBC*eCA));

	long double A = std::sin(2 * aCAB);
	long double B = std::sin(2 * aABC);
	long double C = std::sin(2 * aBCA);

	//外心の位置ベクトル(ベクトルの面積比の公式)
	Point ans;
	ans.real((A*a.real() + B*b.real() + C*c.real()) / (A + B + C));
	ans.imag((A*a.imag() + B*b.imag() + C*c.imag()) / (A + B + C));

	return(ans);
} 

long double solve1(Point, Point, Point);
long double solve2(Point, Point);

int main()
{
	scanf("%d", &N);
	xy.resize(N);
	for (auto& e: xy)
	{
		long double x, y;
		scanf("%Lf%Lf", &x, &y);
		e = {x, y};
	}
	long double ans{1e9};
	for (int i{}; i < N; i++)
		for (int j{i + 1}; j < N; j++)
			for (int k{j + 1}; k < N; k++)
				ans = std::min(ans, solve1(xy[i], xy[j], xy[k]));
	for (int i{}; i < N; i++)
		for (int j{i + 1}; j < N; j++)
			ans = std::min(ans, solve2(xy[i], xy[j]));
	printf("%.9Lf\n", ans);

	return 0;
}

long double solve1(Point a, Point b, Point c)
{
	Point center{Circumcenter(a, b, c)};
	long double r{std::abs(a - center)};
	for (auto& e: xy)
		if (std::abs(e - center) > r + 10 * eps)
			return 1e9;
	return r;
}

long double solve2(Point a, Point b)
{
	Point center{(a + b) / 2.0L};
	long double r{std::abs(a - center)};
	for (auto& e: xy)
		if (std::abs(e - center) > r + 10 * eps)
			return 1e9;
	return r;
}

Measured memory_bytes: 384
def gcd(a,b):
    if a < b:
        a,b = b,a
    if a % b == 0:
        return b
    else:
        return gcd(b,(a % b))
 
N,X=map(int,input().split())
inputcities=list(map(int, input().split()))
cities=[abs(inputcities[i]-X) for i in range(N)]
cities.sort()
D=cities[0]
for i in range(N):
  D=gcd(D,cities[i])
print(D)

Measured memory_bytes: 14252
#include<iostream>
#include<cstdio>
#include<algorithm>

using namespace std;

long long get(int n,int k)
{
    long long *result = new long long[n+1];

    for(int i=1;i<=n;i++)
    {
        result[i] = 1;
        for(int j=i-1;j>=1;j--)
        {
            result[j] = result[j-1]+result[j];
        }
        result[0] = 1;
    }
    return result[k];
}
int main()
{
    int n,in[55],p,odd=0,even=0;
    long long ans=0;
    scanf("%d%d",&n,&p);
    for(int i=0; i<n; i++)
    {
        scanf("%d",&in[i]);
        if(in[i]%2==0)
            even++;
        else
            odd++;
    }
    if(p==0)
    {
        long long ans1=0,ans2=0;
        if(even!=0)
        {
            for(int i=1; i<=even; i++)
            {
                ans1=ans1+get(even,i);
            }
        }
        else
            ans1=0;
        if(odd!=0)
        {
            for(int i=2; i<=odd; i+=2)
            {
                ans2=ans2+get(odd,i);
            }
        }
        else
            ans2=0;
        ans=ans1+ans2+ans1*ans2+1;
    }
    if(p==1)
    {
        long long ans1=0,ans2=0;
        if(odd!=0)
        {
            for(int i=1; i<=odd; i+=2)
            {
                ans1=ans1+get(odd,i);
            }
        }
        else
            ans1=0;
        if(even!=0)
        {
            for(int i=1; i<=even; i++)
                ans2=ans2+get(even,i);
            ans2=ans2*ans1;
        }
        else
            ans2=0;
        ans=ans1+ans2;
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val d = (1..n).map { Pair(sc.next(), sc.next()) }

  var count = 0
  var ok = false
  for (di in d) {
    val d1 = di.first
    val d2 = di.second
    if (d1 == d2) {
      count++
      if (count == 3) {
        ok = true
        break
      }
    } else {
      count = 0
    }
  }

  if (ok) {
    println("Yes")
    return
  }
  println("No")

}


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

int main(void){

    int n;
    cin >> n;
    vector<int> h(n);
    for(int i=0; i<n; i++) {
        cin >> h[i];
    }
    
    int max = 0;
    int current = 0;
    for(int i=0; i<n; i++) {
        
        if(i==0) {
            continue;
        }
        
        if(h[i]<=h[i-1]) {
            current++;
        }
        else {
            if(current>max) {
                max = current;
            }
            current = 0;
        }
    }
    
    if(current>max) max = current;
    
    cout << max << endl;


    return 0;
}


Measured memory_bytes: 640
read H W
read -d "" AA
cnt=0
ans=0

for i1 in `seq $H`
do
	LINE=`echo "${AA}" | sed -n ${i1}p`
	for i2 in `seq $W`
	do
		i2=$((i2 - 1))
		if [ "${LINE:${i2}:1}" = "#" ]
		then
			if [ $((i2 + 1)) -gt ${cnt} ]
			then
				ans=$((ans + 1))
				cnt=$ans
			elif [ $((i2 + 1)) -lt ${cnt} ]
			then
				echo "Impossible"
				exit
			fi
		fi
	done
done
echo "Possible"


Measured memory_bytes: 2576
#include <stdio.h>
#include <string.h>
int main()
{
    int i,j;
    int sum=1;
    char line[100000];
    //int c=0;
    while (1)
    {
        //c+=1;

        sum = 0;
        fgets(line,sizeof(line),stdin);
        if (line[0] == '0') break;
        int n;
        n = strlen(line);
        for (i=0;i<n-1;i++) // fgetsなので最後は改行文字。
        {
            sum += line[i] - '0';
        }
        //if (sum == 0) break;
        printf("%d\n",sum);

    }
    return 0;
}



Measured memory_bytes: 2072
//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;


void dfs(vector<vector<ll>> &d, vector<ll> &x,vector<bool> &sumi, ll cnt, vector<ll> &renketu){
  rep(i,x.size()){
    if(sumi[x[i]])continue;
    else{
      sumi[x[i]] = true;
      renketu[x[i]] = cnt;
      dfs(d,d[x[i]],sumi,cnt,renketu);
    }
  }
}


int main(){
  ll N,M,K;
  cin >> N >> M >> K;
  vector<ll> A(M),B(M);
  vector<ll> C(K),D(K);
  rep(i,M)cin >> A[i] >> B[i];
  rep(i,K)cin >> C[i] >> D[i];

  vector<vector<ll>> d(N+1);
  rep(i,M){
    d[A[i]].push_back(B[i]);
    d[B[i]].push_back(A[i]);
  }

  //vector<set<ll>> kirai(N+1);
  vector<ll> renketu(N+1,0);
  //vector<ll> ans(N+1,0);
  ll cnt = 1;

  vector<bool> sumi(N+1,false);
  renketu[1] = cnt;

  for(int i = 1;i <= N;i++){
    if(sumi[i])continue;
    else{
      if(i==1)sumi[1] = true;
      if(d[i].size()>0){
        dfs(d,d[i],sumi,cnt,renketu);
        cnt++;
      }else{
        renketu[i] = cnt;
        cnt++;
      }

    }

    //ans[i] += cnt;
  }
/*
  for(int i = 1;i <= N;i++){
    cout << renketu[i] << endl;
  }
*/
  vector<set<ll>> haizoku(cnt+5);
  for(int i = 1;i <= N;i++){
    haizoku[renketu[i]].insert(i);
  }

  vector<ll> ans(N+1,0);
  for(int i = 1;i <= N;i++){
    ans[i] = haizoku[renketu[i]].size();
  }

  rep(i,M){
    if(haizoku[renketu[A[i]]].count(B[i]))ans[A[i]]--;
    if(haizoku[renketu[B[i]]].count(A[i]))ans[B[i]]--;
  }
  rep(i,K){
    if(haizoku[renketu[C[i]]].count(D[i]))ans[C[i]]--;
    if(haizoku[renketu[D[i]]].count(C[i]))ans[D[i]]--;
  }

  for(int i = 1;i <= N;i++){
    printf("%lld",ans[i]-1);
    printf(" ");

  }
  printf("\n");

  return 0;

}


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

int main(){
    string s;
    cin >> s;
    int i=0;
    int ac=0;

    while((i<s.size()-1)&&(ac==0)){
        if((s.at(i)=='A')&&(s.at(i+1)=='C')){
            ac++;
        }
        i++;
    }
    if(ac==1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
/*/ Author:amar1503/*/
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("Ofast")
#define fio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ull unsigned long long
#define ll long long
#define inf INT_MAX
#define mninf INT_MIN
#define Mod 1000000007
#define endl "\n"
#define cp(x) cout<<(x)<<" "
#define cl(x) cout<<(x)<<endl
#define nl   cout<<endl
//const double PI=3.1415926535897932384626433832;
//looping
#define For(i,a,b) for(int i=a;i<b;i++)
#define test(t)  int (t); cin>>(t); while((t)--)
#define array(a,n) int (n); cin>>(n); int a[n]; for(int i=0;i<(n);i++) cin>>a[i];
#define trace(x) clog<<#x<<": "<<x<<" "<<endl
#define trace2(x,y) clog<<#x<<": "<<x<<"     "<<#y<<" "<<y<<endl
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define printa(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define printv(v)  for(int i=0;i<(v).size();i++) cout<<v[i]<<" "
//containers
#define F first
#define S second
#define pb emplace_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define all(v) (v).begin(),(v).end()
#define mp make_pair
#define itr(it, a) for(auto it = (a).begin(); it != (a).end(); it++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ers(v)   sort(all(v)); (v).erase(unique(all(v)),(v).end())
#define printmatrix(a,n,m) for(int i=0;i<n;i++){ for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
typedef vector<int> vi;
typedef vector< vector< int > > vvi;
typedef pair <int, int> pii;
typedef vector < pair <int, int> > vpii;
// cout<<"\nTime Elapsed : " << 1.0*clock() /CLOCKS_PER_SEC << " s\n";
//#define int long long
/*/-----------------------------Code begins----------------------------------/*/
int32_t main(){
string s,s1;
cin>>s>>s1;
int a,b;
cin>>a>>b;
string t;
cin>>t;
if(t==s)
    a--;
else b--;
cout<<a<<" " <<b;
}//2 3 2


























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



int main() {
    int n; cin >> n;
    vector<int> a(n); 
    rep(i,n) cin >> a[i];

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

    int alice = 0, bob = 0;

    rep(i,n) {
        if(i%2 == 0) alice += a[i];
        else bob += a[i];
    }

    cout << alice - bob << endl;

    return 0;
}





Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){
			
			int N = scan.nextInt();
			long[]A = new long[N];
			for(int i = 0;i<N;i++)A[i] = scan.nextInt();
			
			long [] D = new long[N];
			
			
			for(int i = 0;i<N;i++) {
				if(i%2==0) {
					D[0]+=A[i];
				}else {
					D[0]+=-A[i];
				}
			}
			
			D[N-1] = 2*A[N-1]-D[0];
			
			for(int i = N-2;i>=1;i--) {
				D[i] = 2*A[i]-D[i+1];
			}
			
			for(int i = 0;i<N;i++) {
				System.out.println(D[i]);
			}
			
			
		}
		
		
	}
		

}


Measured memory_bytes: 70432
s = input()
ans = 'Yes'
if not s == ''.join(s[::-1]):
    ans = 'No'
temp = s[:(len(s)-1)//2]
if not temp == ''.join(temp[::-1]):
    ans = 'No'
temp = s[(len(s)+2)//2:]
if not temp == ''.join(temp[::-1]):
    ans = 'No'
print(ans)

Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

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

        final long n = sc.nextLong();

        List<Long> odds = new ArrayList<>();
        List<Long> evens = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            final long a = sc.nextLong();
            if (i % 2 == 0) {
                odds.add(a);
            } else {
                evens.add(a);
            }
        }

        if (n % 2 == 0) {
            Collections.reverse(evens);
            evens.addAll(odds);
            System.out.println(evens.stream().map(String::valueOf).collect(Collectors.joining(" ")));
        } else {
            Collections.reverse(odds);
            odds.addAll(evens);
            System.out.println(odds.stream().map(String::valueOf).collect(Collectors.joining(" ")));
        }
    }
}


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

int main() {
    int n,k,c;
    cin>>n>>k>>c;

    string s;
    cin>>s;
    s = " "+s;
    vector <int> l;
    vector <int> r;
    int i = 1;
    while (i<=n){
        if (s[i]=='o'){
            l.push_back(i);
            i += c+1;
        }
        else if (s[i] == 'x'){
            i++;
        }
    }
    i = n;
    while (i>0){
        if (s[i]=='o'){
            r.push_back(i);
            i -= c+1;
        }
        else if (s[i] == 'x'){
            i--;
        }
    }
    if (l.size()>=k and r.size()>=k){
        for (int i=0; i<k; i++){
            if (l[i] == r[k-1-i]){
                cout<<l[i]<<endl;
            }
        }
    }
}




Measured memory_bytes: 3384