akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

void trace(int A[], int N) {
  int i;
  for ( i = 0; i < N; i++ ) {
    if ( i > 0 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

void insertionSort(int A[], int N) {
  int i, v, j;
  for ( i = 1; i < N; i++ ) {
    v = A[i];
    j = i - 1;
    while ( j >= 0 && A[j] > v ) {
      A[j + 1] = A[j];
      j--;
    }
    A[j + 1] = v;
    trace(A, N);
  }
}

int main() {
  int N, i, j;
  int A[100];

  scanf("%d", &N);
  for ( i = 0; i < N; i++ ) scanf("%d", &A[i]);

  trace(A, N);
  insertionSort(A, N);

  return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
	#include <fstream>
	#include <vector>
	#include <bitset>
	#include <unordered_map>
	#include <algorithm>
	#include <queue>
	#include <math.h>
	#include <iomanip>

	using namespace std;

	/********** TEMPLATE STARTS HERE ***********/

	#define IOS ios::sync_with_stdio(false), cin.tie(0);
	#define all(v) v.begin(), v.end()
	#define F first
	#define S second
	#define pb push_back
	#define PI 3.1415926535897932384626433832795
	#define gcd __gcd 
	#define digits(n) (int)(log10(n) + 1)

	typedef long long ll;
	typedef pair <int, int> pii;
	typedef pair <ll, ll> pll;
	typedef vector <int> vi;
	typedef vector <long long> vl;
	typedef vector <pll> vll;
	typedef vector <pii> vii;

	const int INF = 0x3f3f3f3f;
	const int LINF = 0x3f3f3f3f3f3f3f3f;

	template <typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
	template <typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

	/********** TEMPLATE ENDS HERE ***********/

	main()
	{
		IOS
		
		int a, b, c;
		cin >> a >> b >> c;
		
		if(c >= a && c <= a + b)
		{
			cout << "YES";
		}
		else
		{
			cout << "NO";
		}
	}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String a = sc.next();
        String b = sc.next();

        BigDecimal aBig = new BigDecimal(a);
        BigDecimal bBig = new BigDecimal(b);

        BigDecimal floor = aBig.multiply(bBig).setScale(0, RoundingMode.FLOOR);
        System.out.println(floor.toString());
    }
}

Measured memory_bytes: 35996
#include <bits/stdc++.h>  // ver2.1.4
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define Pii pair<int,int>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int, vector<int>, greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a.back()<<endl
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int mypow(int x, int n, int m){  //  高速累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}

signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int n,h;
  cin >> n >> h;
  Vi a(n),b(n);
  rep(i,0,n) cin >> a[i] >> b[i];
  int maxa = *max_element(ALL(a));
  sortr(ALL(b));
  
  rep(i,0,n){
    if(b[i] < maxa) b[i]=0;
  }
  
  int sumb=0,ans =0;
  rep(i,0,n){
    sumb += b[i];
    if(b[i]!=0) ans++;
    if(sumb >= h){cout<<ans<<endl;return 0;}
    //cout<<sumb<<' ';
  }
  int nkr = h-sumb;
  //cout << nkr << endl;
  ans += dem(nkr,maxa);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<queue>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  queue<int> q1,q2;
  int x,y,ans=0,b[60][60],i,j,h,w,a[60][60];
  char s;
  int INF=(1<<29);
  scanf("%d %d\n",&h,&w);
  for(i=0;i<=h+1;i++){
    for(j=0;j<=w+1;j++){
      a[i][j]=0,b[i][j]=INF;
    }
  }
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      scanf("%c",&s);
      if(s=='.'){
        a[i][j]=1;
      }
      else{
        ans++;
      }
    }
    scanf("\n");
  }
  q1.push(1),q2.push(1);
  b[1][1]=1;
  while(!q1.empty()){
    x=q1.front(),y=q2.front();
    q1.pop(),q2.pop();
    if(a[x+1][y]==1 && b[x+1][y]>b[x][y]+1){
      q1.push(x+1),q2.push(y);
      b[x+1][y]=b[x][y]+1;
    }
    if(a[x-1][y]==1 && b[x-1][y]>b[x][y]+1){
      q1.push(x-1),q2.push(y);
      b[x-1][y]=b[x][y]+1;
    }
    if(a[x][y+1]==1 && b[x][y+1]>b[x][y]+1){
      q1.push(x),q2.push(y+1);
      b[x][y+1]=b[x][y]+1;
    }
    if(a[x][y-1]==1 && b[x][y-1]>b[x][y]+1){
      q1.push(x),q2.push(y-1);
      b[x][y-1]=b[x][y]+1;
    }
  }
  if(b[h][w]==INF){
    printf("-1\n");
    return 0;
  }
  printf("%d\n",h*w-ans-b[h][w]);
  return 0;
}

Measured memory_bytes: 256
using System;
class AOJ
{
    public static void Main()
    {
        int[,,] Tou = new int[4, 3, 10];
        int a = int.Parse(Console.ReadLine());
        for (int i = 0; i < a; i++)
        {
            string[] st = Console.ReadLine().Split(' ');
            Tou[int.Parse(st[0]) - 1, int.Parse(st[1]) - 1, int.Parse(st[2]) - 1] += int.Parse(st[3]);
        }
        for (int i = 0; i < 4; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                for (int n = 0; n < 10; n++)
                {
                    Console.Write(" " + Tou[i, j, n]);
                    if (n == 9)
                        Console.WriteLine();
                }
            }
            if (i != 3)
                Console.WriteLine("####################");
        }
    }
}


Measured memory_bytes: 15980
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define case(i) cout<<"Case #"<<i<<": "
using namespace std;
typedef long long int ll;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 4e18;

ll p;
ll f(ll d) {
	ll x = d + p, y = d + p * 10;
	string xx = to_string(x), yy = to_string(y);
	int xsum = 0, ysum = 0;
	rep(i, 0,xx.size()) {
		xsum += xx[i] - '0';
	}
	rep(i, 0, yy.size()) {
		ysum += yy[i] - '0';
	}
	if (x * ysum <= y * xsum) return x;
	else {
		p *= 10;
		return y;
	}
}

int main() {
	ll k; cin >> k;
	ll n = 1; p = 1;
	rep(i, 0, k) {
		cout << n << endl;
		n = f(n);
	}
	return 0;
}

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



struct node{
  int lc;
  int rc;
  int key;
  void init(int a){
    lc=rc=-1;
    key=a;
  }
};

#define bstN 600000
struct bst{

  int size;
  node t[bstN];

  void init(){
    size=0;
  }
  
  void insert(int v){
    int i=0;
    while(i<size){
      int& child=(v<t[i].key?t[i].lc:t[i].rc);
      if(child==-1)child=size;
      i=child; 
    }
    t[size++].init(v);
  }

  void preord(int pos){
    if(pos==-1||pos==size)return;
    preord(t[pos].lc);
    printf(" %d",t[pos].key);
    preord(t[pos].rc);
  }
  
  void inord(int pos){
    if(pos==-1||pos==size)return;
    printf(" %d",t[pos].key);
    inord(t[pos].lc);
    inord(t[pos].rc);
  }
};


bst T;

int main(){
  T.init();
  int n,a;
  char str[100];
  scanf("%d",&n);
  
  while(n--){
    scanf("%s",str);
    if(str[0]=='i'){
      scanf("%d",&a);
      T.insert(a);
    }else{
      T.preord(0);
      printf("\n");
      T.inord(0);
      printf("\n");
    }
  }

  return 0;
}



Measured memory_bytes: 9020
#include <iostream>
#include <iomanip>
using namespace std;
int main(void){
    double n,m,d,p;
    cin>>n>>m>>d;
    p=(m-1)/n;
    if(d>0){
        p*=2*(n-d)/n;
    }
    cout<<setprecision(12)<<p<<endl;
}


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

target = [x for _ in range(n)]

cnt = 0

for i in range(n - 1):
	if a[i] + a[i + 1] > target[i]:
		tmp = min(a[i + 1], a[i] + a[i + 1] - target[i])
		cnt += tmp
		a[i + 1] -= tmp

if a[0] + a[1] > target[0]:
	cnt += a[0] - target[0]
	a[0] -= a[0] - target[0]

print(cnt)

Measured memory_bytes: 64356
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
int N;
  cin >>N;
  vector<char> vec(N);
  rep(i,N) {
cin >>vec.at(i);
  }
bool answer=false;
  rep(i,N) {
if (vec.at(i)=='Y') {
  answer=true;
  break;
}
  }
  
  if(answer) {
cout<< "Four"<< endl;
  }
  else {
cout<< "Three" << endl;
  }
}
  
  

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        int c = input.nextInt();
        int count = 0;
        
        for (int i = a; i <= b; i++) {
            if (c % i == 0) {
                count++;
            }
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 26300
#include <iostream>
#include <deque>
using namespace std;
typedef long long ll;

const int N = (int)1e6;
int mc[N+1];

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

	int n;
	cin >> n;

	string str;
	cin >> str;
	for (int i = 1; i <= n; ++i) mc[i] = mc[i-1] + (str[i-1] == 'M');

	int q;
	cin >> q;
	
	deque<int> que;
	for (int t = 0; t < q; ++t) {
		int k;
		cin >> k;

		ll ds = 0;
		ll ms = 0;
		ll cs = 0;
		ll m_tot = 0;

		for (int i = 0; i < n; ++i) {
			while((! que.empty()) && (que.front() <= i-k)) {
				int x = que.front();
				que.pop_front();

				--ds;
				ms -= mc[i] - mc[x];
			}

			if (str[i] == 'D') {
				++ds;
				que.push_back(i);
			}
			if (str[i] == 'M') ms += ds;
			if (str[i] == 'C') cs += ms;
		}
		que.clear();

		cout << cs << '\n';
	}
}

Measured memory_bytes: 9244
N,M=map(int,input().split())
py=[[i]+list(map(int,input().split())) for i in range(M)]
ken=[[] for _ in range(N)]

for i in py:
  ken[i[1]-1].append(i)
ans=[[i[1]] for i in py]
for i in ken:
  i.sort(key=lambda x:x[2])
  for j in range(len(i)):
    ans[i[j][0]].append(j+1)

for p,x in ans:
  print("".join([str(p).zfill(6),str(x).zfill(6)]))

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

struct Vertex {
    vector<ll> node;
};

Vertex V[100005];
bool U[100005];
ll Parent[100005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    REP(_, M) {
        ll a, b;
        cin >> a >> b;
        V[a].node.push_back(b);
        V[b].node.push_back(a);
    }

    REP(i, N) {
        Parent[i] = i;
    }
    memset(U, 0, sizeof(U));

    REP(i, N) {
        if (U[i])
            continue;
        queue<ll> q;
        q.push(i);
        U[i] = true;
        while (!q.empty()) {
            ll t = q.front();
            q.pop();
            for (auto &n:V[t].node) {
                if (U[n])
                    continue;
                Parent[n] = i;
                q.push(n);
                U[n] = true;
            }
        }
    }

    ll Q;
    cin >> Q;
    REP(_, Q) {
        ll s, t;
        cin >> s >> t;
        if (Parent[s] == Parent[t])
            cout << "yes" << endl;
        else
            cout << "no" << endl;
    }
    
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  int l = s.size();

  vector<int> number(26, 0);
  for (int i = 0; i < l; i++) {
    number[s[i] - 'a']++;
  }
  
  for (int i = 0; i < 26; i++) {
    if (number.at(i) == 0) {
      cout << (char)(i + 'a') << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}

Measured memory_bytes: 512
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
N,M = map(int,input().split())
A=[]
B=[]
for i in range(M):
    n,a=input().split()
    A.append(int(n))
    B.append(int(a))
uf = UnionFind(N)
for i in range(len(A)):
    uf.union(A[i]-1,B[i]-1)
ans=0
for i in range(N):
    ans=max(ans,uf.size(i))
print(ans)

Measured memory_bytes: 29996
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

int main(){
    fast_io
    
    ll x;
    cin>>x;
    ll place=0;
    ll ans=0;
    for(ll i=1;place<x;i++){
        place=(i*(i+1))/2;
        ans=i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,a,b;
    cin>>n;
    long long int x[n+5],y[n+5];
    for(int i=0;i<n;i++){
        cin>>y[i];
        x[i]=y[i];
    }
    
    sort(x,x+n);
    a=x[(n/2)-1];
    b=x[n/2];
    for(int j=0;j<n;j++){
        if(y[j]>=b){
            cout<<a<<endl;
        }
        else{
            cout<<b<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 5376
# coding: utf-8
class Dice:
    
    def __init__(self):
        self.data = {"bottom":5, "west": 3, "north" : 4,
                "east": 2, "south" : 1,"top" : 0}
    
    def moveOne(self, direction):
        if direction == "W":
            temp = self.data["bottom"]
            self.data["bottom"] = self.data["west"]
            self.data["west"] = self.data["top"]
            self.data["top"] = self.data["east"]
            self.data["east"] = temp
        elif direction == "E":
            temp = self.data["bottom"]
            self.data["bottom"] = self.data["east"]
            self.data["east"] = self.data["top"]
            self.data["top"] = self.data["west"]
            self.data["west"] = temp
        elif direction == "N":
            temp = self.data["bottom"]
            self.data["bottom"] = self.data["north"]
            self.data["north"] = self.data["top"]
            self.data["top"] = self.data["south"]
            self.data["south"] = temp
        elif direction == "S":
            temp = self.data["bottom"]
            self.data["bottom"] = self.data["south"]
            self.data["south"] = self.data["top"]
            self.data["top"] = self.data["north"]
            self.data["north"] = temp

    def movePart(self, directions):
        for direction in directions:
            self.moveOne(direction)
            
    def setDiceII(self, a, b):
        if self.data["east"] == a:
            self.moveOne("W")
        elif self.data["north"] == a:
            self.moveOne("S")
        elif self.data["west"] == a:
            self.moveOne("E")
        elif self.data["south"] == a:
            self.moveOne("N")
        elif self.data["bottom"] == a:
            self.movePart("WW")

        if self.data["north"] == b:
            self.rotateRight()
            self.rotateRight()
        elif self.data["east"] == b:
            self.rotateRight()
        elif self.data["west"] == b:
            self.rotateLeft()
            
        # self.printDice()
    
    def rotateRight(self):
        temp = self.data["east"]
        self.data["east"] = self.data["north"]
        self.data["north"] = self.data["west"]
        self.data["west"] = self.data["south"]
        self.data["south"] = temp
    
    def rotateLeft(self):
        temp = self.data["west"]
        self.data["west"] = self.data["north"]
        self.data["north"] = self.data["east"]
        self.data["east"] = self.data["south"]
        self.data["south"] = temp
      
    def getSurface(self):
        return self.data["top"]
    
    def getEast(self):
        return self.data["east"]
        
    def printDice(self):
        print(self.data["north"])
        print(str(self.data["west"]) + " " + str(self.data["bottom"]) + " " + str(self.data["east"]) )
        print(self.data["south"])
        print(self.data["top"])


num = list(map(int,input().rstrip().split()))
n = int(input().rstrip())
dice = Dice()
for i in range(n):
    top, south = map(int,input().rstrip().split())
    dice.setDiceII(num.index(top),num.index(south))
    print(num[dice.getEast()])


Measured memory_bytes: 5844
#include<stdio.h>
int main()
{
    int W,H,x,y,r;
    scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
    if(x>=r&&x<=(W-r)&&y>=r&&y<=(H-r))
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#define mod 1000000007
#define ten5 100005
#define PI 3.1415926
using namespace std;



int main()
{
    //int m,n,o=0,i,j,k;
    long long int sum=0,sum2=0,range=0,fir=0,sec=0;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=0,start=0;
    //vector <int> v;
    //float f,g,h;
    char now,pre;
    //string a;
    while(1)
    {
        if(cin.peek()=='\n') break;
        cin>>now;
        if(now=='B' && range==0) range=1;
        if(range==0 && now=='W') start++;
        if(range==1 && now=='W') sum+=k-start++;
        k++;
    }
    cout<<sum;
    return 0;
}





Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); 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; }

int main() {
	int n, l;
	cin >> n >> l;
	int min = l, max = l+n-1;
	int sum=0;
	for(int i=1; i<=n; i++) {
		sum += l+i-1;
	}
	//cout << sum << " ";
	int ans;
	if(min <= 0 && max >= 0) {
		ans = sum;
	}
	else if(min < 0 && max < 0) ans = sum - max;
	else if(min > 0 && max > 0) ans = sum - min;
	cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import collections

n = int(input())
v = list(map(int, input().split()))

odd_l = []
even_l = []

if v.count(v[0]) == n:
    ans = n // 2
else:
    for i in range(0, n, 2):
        odd_l.append(v[i])
        even_l.append(v[i+1])

    odd_c = collections.Counter(odd_l)
    even_c = collections.Counter(even_l)

    odd = odd_c.most_common()[0][1]
    odd_num = odd_c.most_common()[0][0]

    even = even_c.most_common()[0][1]
    even_num = even_c.most_common()[0][0]

    if odd_num != even_num:
        ans = n - (odd + even)
    else:
        odd = odd_c.most_common()[1][1]
        even = even_c.most_common()[0][1]
        ans_change_odd = n - (odd + even)

        odd = odd_c.most_common()[0][1]
        even = even_c.most_common()[1][1]
        ans_change_even  = n - (odd + even)

        ans = min(ans_change_odd, ans_change_even)

print(ans)

Measured memory_bytes: 20576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define all(v) v.begin(), v.end()

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, int p, vector<int> &checker, vector<bool>& seen){
  seen[v]=true;
  checker[v]=p;
  cout<<v<<" : "<<p<<endl;
  queue<int> q;
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,v,checker,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int n,m;cin>>n>>m;
  vector<vector<int>> g(n);
  for(int i=0;i<m;i++){
    int a,b;cin>>a>>b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<int> ans(n);
  vector<bool> seen(n,false);
  queue<int> q;
  q.push(0);
  while(!q.empty()){
    int val=q.front();q.pop();
    for(int i:g[val]){
      if(seen[i]){
        continue;
      }
      ans[i]=val;
      q.push(i);
      seen[i]=true;
    }
  }
  cout<<"Yes"<<endl;
  for(int i=1;i<n;i++){
    cout<<ans[i]+1<<endl;
  }
  return 0;
}


Measured memory_bytes: 10124
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N; cin >> N;
	vector<int> a(N, 0);
	rep (i, N){
		cin >> a[i];
	} // end rep

	map<int,int> cnt; cnt.clear();
	rep (i, N){
		++cnt[a[i]];
	} // end rep

	int res = 0;
	map<int,int>::iterator it = cnt.begin();
	for (; it != cnt.end(); ++it){
		int x = (*it).first;
		int c = (*it).second;
		int curr = c;
		if (cnt.count(x-1)){
			curr += cnt[x-1];
		} // end if
		if (cnt.count(x+1)){
			curr += cnt[x+1];
		} // end if
		res = max(res, curr);
	} // end for

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 3584
const processData = (lines) => {
  const k = +lines[0]
  const s = lines[1]
  if (s.length > k) {
    console.log(s.slice(0, k) + '...')
  } else {
    console.log(s)
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})


Measured memory_bytes: 29872
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
CD = [tuple(map(int, input().split())) for _ in range(M)]
f = lambda ab: min((abs(ab[0]-CD[i][0])+abs(ab[1]-CD[i][1]),i+1) for i in range(M))[1]
print(*[f(ab) for ab in AB], sep="\n")

Measured memory_bytes: 3064
#include<stdio.h>

int main(void){
  int A,B,n=1,x;
  scanf("%d %d",&A,&B);
  if(B==1){
    printf("0");
    return 0;
  }
  x=A;
  while(x<B){
    x=x+A-1;
    n+=1;
  }
  printf("%d\n",n);
  
  return 0;
}

Measured memory_bytes: 1720
/** Bismillahir Rahmanir Rahim **/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define Fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define print(x) cout << "#x - " << x << endl;

int main()
{
   string s, a;
   cin >> s;
   a = s;
   reverse(s.begin(), s.end());
   if (s == a) {
      string f, se;
      f = a.substr(0, (s.size() - 1)/2);
      se = a.substr((a.size() + 3)/2, a.size()-1 - (a.size() + 3)/2);
      string ff, see;
      ff = f;
      see = se;
      // cout << ff << " " << se << endl;

      reverse(f.begin(),f.end());
      reverse(se.begin(), se.end());
      if (f == ff and se == see) cout << "Yes\n";
      else cout << "No\n";
   }
   else cout << "No\n";

    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define fst first
#define sc second
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;

const int N = 40;
const int LOG = 21;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLMOD = 998244353;
const ll LLINF = 1e18;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    string prev = "";
    int ans = 0;
    forn(i, sz(s)) {
        string cur = "";
        int j = i;
        while (j < sz(s) && (cur == "" || cur == prev)) cur.pb(s[j++]);
        if (prev != cur) ans++;
        prev = cur;
        i = j - 1;
    }
    cout << ans << "\n";
    return 0;
}

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

int cnt[100010];

int main(){
	int N;
	cin>>N;
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		if(a-1>0)cnt[a-1]++;
		cnt[a]++;
		if(a+1<=100000)cnt[a+1]++;
	}
	int ans=0;
	for(int i=0;i<=100000;i++){
		if(ans<cnt[i])ans=cnt[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
use std::str::FromStr;
use std::io::stdin;
use std::cmp::min;

fn main() {
    let (n, a, b) = {
        let line = read_vec::<u64>();
        (line[0], line[1], line[2])
    };
    println!("{}", min(a * n, b))
}

fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).ok();
    line.trim().split_whitespace()
        .map(|i| i.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
using System;
public class c
{
  public static void Main()
  {
    string S= Console.ReadLine();
    
            int sum = S.Length;
 
            long wSum = 0;
            long ans = 0;
 
            for(int i = 0; i < sum; i++)
            {
                if (S[sum - i - 1] == 'W')
                {
                    wSum++;
                }
                else
                {
                    ans += wSum;
                }
            }
    Console.WriteLine(ans);
  }
}

Measured memory_bytes: 13112
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int lli;
typedef pair<int, int> pii;
typedef pair<lli, lli> pll;
const lli inf = 1e18;

int main(){
	int n;
	cin >> n;
	cout << (n-2)*180 << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
自力ではわからず解説PDFを見て実装
"""

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

A = input()
counter = Counter(A)

N = len(A)
ans = N * (N - 1) // 2 - sum(c * (c - 1) // 2 for c in counter.values()) + 1
print(ans)


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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }

const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }
// ll comb(ll n, ll k) { ll v=1; for(ll i=1; i<=k; i++) v = DIV(MUL(v, n-i+1),i); return v; }
//

#define INTSPACE 12
char _buf[INTSPACE*1000000 + 3];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}

int loadvec(vector<int>& v, int N=-1) {
    if (N == -1) {
        N = loadint();
        if (N==0) return 0;
    }
    int bufsize = INTSPACE*N + 3;
    if (fgets(_buf, bufsize, stdin)==NULL) return 0;
    v.resize(N);

    int i=0;
    bool last = false;
    for (char *p=&_buf[0]; ;) {
        char *q = p;
        while (*q > ' ') ++q;
        if (*q == 0x0D || *q == 0x0A) last = true;
        *q = 0;
        v[i++] = atoi(p);
        if (last || i == N) break;
        p = q+1;
    }
    // assert(i <= N);
    return i;
}
void read_cr() {
    fgets(_buf, 256, stdin);
}

bool solve(int N, vi& D, int M, vi& T) {
    map<int,int> m1, m2;
    rep(i,N) m1[D[i]]++;
    rep(i,M) m2[T[i]]++;
    for (ii p: m2) {
        if (m1[p.first] < p.second) return false;
    }
    return true;
}

int main() {
    vi D;
    int N = loadvec(D);
    vi T;
    int M = loadvec(T);
    cout << (solve(N,D,M,T) ? "YES":"NO") << endl;
    return 0;
}


Measured memory_bytes: 22528
#include <bits/stdc++.h>
using namespace std;
const int MX = 200005;
long long dp[MX];  // dp[i]表示价值为i时的最小体积
int main()
{
	int n,w;
	cin >> n >> w;
	for(int i = 0; i < MX; ++i) dp[i] = 1001002003004005006ll;
	dp[0] = 0;
	for(int i = 0; i < n; ++i)  
	{
		int a,b;
		cin >> a >> b;
		for (int j = MX-1; j >= b; --j) 
			dp[j] = min(dp[j], dp[j - b] + a);
	}
	int ans = 0;
	for(int i = 0; i < MX; ++i)
		if (dp[i] <= w) ans = i;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void) {
	int n;
	int ans = 0;
	int min = 10;
	for (int i = 0; i < 5; ++i) {
		scanf("%d", &n);
		ans += n +  (n % 10!=0?10- n % 10:0);
		if (n%10!=0&& n % 10 < min) {
			min = n % 10;
		}
	}
	printf("%d", ans-10+min);

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
  int n=0,ans;
  cin >>n;
  while(n!=-1){
    ans=0;
    if(n>30){
      ans+=(n-30)*160;
      n=30;
    }
    if(n>20){
      ans+=(n-20)*140;
      n=20;
    }
    if(n>10)
      ans+=(n-10)*125;
    cout <<4280-(ans+1150)<<endl;
    cin>> n;
  }
  return 0;
}



Measured memory_bytes: 3128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

const long long INF = 100000000000000;

struct Node
{
	vector<int> to;
	vector<long long> cost;
};

struct Edge
{
	int from;
	int to;
	long long cost;
};

int main()
{
	int n,m,p;
	cin >> n >> m >> p;
	vector<Node> nodes(n);
	for(int i=0;i<m;i++)
	{
		int a,b,c;
		cin >> a >> b >> c;
		a--;b--;c*=(-1);c+=p;
		nodes[a].to.push_back(b);
		nodes[a].cost.push_back(c);
	}

	vector<long long> dist(n,INF);
	dist[0]=0;

// Bellman_Ford	
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			for(int k=0;k<nodes[j].to.size();k++)
			{
				if(dist[j]!=INF and dist[nodes[j].to[k]]>dist[j]+nodes[j].cost[k])
					dist[nodes[j].to[k]]=dist[j]+nodes[j].cost[k];
			}
		}
	}

	for(int i=0;i<5000;i++)
	{
		for(int j=0;j<n;j++)
		{
			for(int k=0;k<nodes[j].to.size();k++)
			{
				if(dist[j]!=INF and dist[nodes[j].to[k]]>dist[j]+nodes[j].cost[k])
					dist[nodes[j].to[k]]=-INF;
			}
		}
	}
	cout << (dist[n-1]==-INF ? -1 : (dist[n-1]>0 ? 0:-dist[n-1])) << endl;


}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, X;
  cin >> N >> X;
  llvec x(N);
  rep(i, N)cin >> x[i];
  sort(ALL(x));
  ll g=1e18;
  rep(i, N){
    g = min(abs(X-x[i]), g);
  }
  rep(i, N-1){
    g = gcd(g, x[i+1] - x[i]);
  }
  cout << g;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<long long int> 
#define pb push_back
#define f(i,x,n) for (i=x;i<n;i++)

void printvec(vector<ll> a){
    if(a.size() == 0){
        return; 
    }
    for(int i = 0; i < a.size(); i++){
        cout << a[i] << " ";
    }
    cout << endl;
    return;
}
bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 
void solve(){
    int n;
    cin >> n;
    int a[n];
    map<int,int> m;
    for(int i=0;i<n;i++){
    cin >> a[i];
    m[a[i]]++;
    }    
    int c=0;
    ll ans=0;
    sort(a,a+n);
    for(int i=0;i<n-1;i++)
    {
        for(int j=i+1;j<n-1;j++)
        {
            if(a[i]==a[j])
                continue;
            for(int k=j+1;k<n;k++)
            {
                if(a[j]!=a[k] && a[j]!=a[k])
                {
                    if(a[i]+a[j]>a[k])
                        ans++;
                }
            }
        }
    }
    cout<< ans;
    
}
int main(){
	ios_base::sync_with_stdio(false); 
     	cin.tie(NULL);
	int t=1;
	
	while(t--)
	solve();	
	
}

Measured memory_bytes: 3668
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int X,A,B;
  string S="safe";
  cin>>X>>A>>B;
  if(B-A<=0) S="delicious";
  if(B-A>X) S="dangerous";
  cout<<S;
return 0;}

Measured memory_bytes: 3636
#include <iostream>

int main () {
	int i, j, cnt = 0;
	std::string str, s;
	std::cin >> str >> s;
	for (i = 0; i < str.size(); ++ i) {
		if (str[i] == s[i]) ++ cnt;
	}
	std::cout << cnt;

	return 0;
}

Measured memory_bytes: 256
# ABC137c
import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
s = dict()
for _ in range(n):
    t = tuple(sorted(input()))
    if (s.get(t) == None):
        s[t] = 1
    else:
        s[t] += 1
c = 0
for i in s.values():
    if(i>1):
        c += math.factorial(i) // (math.factorial(i - 2) * math.factorial(2))
print(c)

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

string s;

int main() {
  cin >> s;
  for (int i = 1; i < s.size(); ++i)
    if (s[i - 1] == 'A' && s[i] == 'C') {
      cout << "Yes" << endl;
      return 0;
    }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3616
O = input()
E = input()
tmp = max(len(O), len(E))
ans = ''
for i in range(tmp):
    if len(O) - 1 >= i and len(E) - 1 >= i:
        ans += O[i] + E[i]
    elif len(O) - 1 < i and len(E) - 1 >= i:
        ans += E[i]
    elif len(O) -1 >= i and len(E) - 1 < i:
        ans += O[i]

print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;

typedef long long LL;

const int N = 2e6;

int main()
{
	LL a , b , c;
	bool flag = false;
	scanf("%lld %lld %lld",&a , &b , &c);
	for(LL i = 1 ; i <= N ; i++){
		if((i * a) % b == c){
			flag = true;
		}
	}
	if(flag) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

#define LOOP 1

#define LOOP_RESET 1

#define LOOP_END 0

#define COUNT_RESET 0

#define RETURN 0

int main(){

        unsigned short usW_D_set;               /* 使用できる最大値格納用変数 */

        unsigned long ulW_D_tag;                /* 目標値格納用変数 */

        signed short ssW_D_mid;                 /* 計算用変数 */

        unsigned short usW_C_i, usW_C_j;        /* ループ変数 */

        unsigned short usW_C_num_count;         /* 目標を満足する値のカウンタ */

        /* 数値の入力、演算を無限ループ */

        while(LOOP){

                /* 使用できる最大値、目標値の入力 */

                scanf("%d %ld", &usW_D_set, &ulW_D_tag);

                

                /* 終了処理 */

                if((usW_D_set == LOOP_END) && (ulW_D_tag == LOOP_END)){

                        break;

                }

                /* カウンタをリセット */

                usW_C_num_count = COUNT_RESET;

                

                /* 目標を満足する値をカウント */

                for(usW_C_i = LOOP_RESET;usW_C_i < usW_D_set;usW_C_i++){

                        for(usW_C_j = usW_C_i;usW_C_j <= usW_D_set;usW_C_j++){

                                /* usW_C_i + usW_C_j と目標値の差をssW_D_midに代入 */

                                ssW_D_mid = ulW_D_tag - (usW_C_i + usW_C_j);

                                /* ssW_D_midがusW_C_iとusW_C_jの間にある場合カウント*/

                                if((usW_C_i < ssW_D_mid)  && (ssW_D_mid < usW_C_j)){

                                        usW_C_num_count++;

                                }

                        }

                }

                

                /* 結果の出力 */

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

                

        }

        

        return RETURN;

}




Measured memory_bytes: 2052
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			System.out.println(isBuyPattern(scanner.nextInt()) == true ? "Yes" : "No");
		}
	}
	private static boolean isBuyPattern(int n) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (4 * i + 7 * j == n) {
					return true;
				}
			}
		}
		return false;
	}
}

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

int main()
{
	int n;
	long long k;
	cin >> n >> k;
	long cnt[100001];
	for (size_t i = 0; i < 100001; i++)
	{
		cnt[i] = 0;
	}
	for (size_t i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;
		cnt[a] += b;
	}
	long c = 0;
	for (size_t i = 0; i < 100001; i++)
	{
		c += cnt[i];
		if (c >= k)
		{
			cout << i << endl;
			break;
		}
	}
    return 0;
}



Measured memory_bytes: 1024
n = int(input())
l = list(map(int, input().split()))
count = 0
cnt = 0
for j in l:
    if j % 2 == 0:
        count += 1
for i in l:
    if i % 6 == 0 or i % 10 == 0:
        cnt += 1
if cnt == count:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
#include <math.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>a(1000000);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end(),greater<>());
    cout<<a[0]-a[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 7176
// macros
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define debug(a) cout << "L(" << __LINE__ << "):" << #a << ":" << a << endl;

// problems limits
#define MAX_N 1000

// Variables
int N;
ll A[MAX_N], T[MAX_N];

// problems input
void input()
{
    cin >> N;
    FOR(i,0,N) cin >> T[i] >> A[i];
}

// problems main
void solve()
{
    ll t = 1, a = 1;
    FOR(i,0,N) {
        ll da = a / A[i] + ( (a%A[i]) ? 1 : 0 );
        ll dt = t / T[i] + ( (t%T[i]) ? 1 : 0 );
        if (da > dt) {
            a = A[i] * da;
            t = T[i] * da;
        } else {
            a = A[i] * dt;
            t = T[i] * dt;
        }
    }
    cout << t+a << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    input();

    solve();
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
 
#define f(i,a,b) for(int i=a;i<b;i++)
#define fll(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define vvi vector<vector<int> >
#define ss second
#define ff first
#define ll long long
#define lld long double
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pq priority_queue< int >
#define pqll priority_queue< ll >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define INF 1000000000
#define NINF -1000000000

const ll  mod1 =  1e9 + 7;
ll mult(ll a, ll b){
    return (ll)(a*b%mod1);
}

void solve(){
    
    int k;
    cin >> k;
    string a;
    cin >> a;
    if (a.size() <= k){
        cout << a << endl;
    }
    else{
        a.resize(k);
        cout << a <<"..." << endl;
    }
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cerr.tie(nullptr);

    int t = 1;
    // cin >> t;
    
    while(t--){    
        solve();
    }
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int n;
    cin >> n;
    int num[100001]={0};
    ll sum = 0;
    rep(i,n){
        int a;
        cin >> a;
        sum += a;
        num[a]++;
    }
    int q;
    cin >> q;
    rep(i,q){
        int b,c;
        cin >> b >> c;
        sum += num[b]*(c-b);
        cout << sum << endl;
        num[c] += num[b];
        num[b]=0;
    }
}

Measured memory_bytes: 4008
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << min(a,b) + min(c,d) << endl;

    return 0;
}


Measured memory_bytes: 256
'use strict'

function main(input) {
    input = input.split('\n')
    const troops = input[1].split('')
    const n = Number(input[0])

    let countsW = [0]
    for (let i = 1; i <= n; i++) {
        countsW[i] = (troops[i - 1] == 'W') ? countsW[i - 1] + 1 : countsW[i - 1];
     }

    let min, cnt = 0
    for (let i = 0; i < n; i++) {
        cnt = parseInt(countsW[i]) 
            cnt += n - (i+1) - (countsW[n] - countsW[i + 1]) 

            min = (min < cnt) ? min : cnt
    }

    console.log(min)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064