akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
int main(void)
{
  string s, r;
  cin>>s>>r;
  for(int i=0; i<s.size(); i++)
  {
    if(s[i]!=r[i])
    {
      cout<<"No\n";
      return 0;
    }
  }
  
  cout<<"Yes\n";
  return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>

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

int main(void) {
    int n,cnt=0;
    scanf("%d",&n);
    int l[n];
    for(int i=0;i<n;i++){
      scanf("%d", &l[i]);
    }
    qsort(l, sizeof(l)/sizeof(int), sizeof(int), so);
    for(int i=0; i<n-2; i++){
        for(int j=i+1; j<n-1; j++){
            for(int k=j+1; k<n; k++){
                if(l[k] < l[i] + l[j]) cnt++;
            }
        }
    }
    printf("%d\n", cnt);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;

void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}



int main()
{
	int a, b;
	cin >> a >> b;
	cout << 6 - a - b << endl;


	return 0;
}

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

int main(){
  int N;
  cin >> N;
  while(1){
    if(N%10==7){
      cout << "Yes" << endl;
      break;
    }else{
      N /= 10;
      if(N==0){
        cout << "No" << endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int w = sc.nextInt();
            //w是总共有几根棒棒
            int n = sc.nextInt();
            //n是换几次
            int[] values = new int[w];
            for (int i = 0; i < values.length; i++) {
                values[i] = i + 1;
                //棒棒一开始的值是1.2.3.4.5.6……
            }
            int temp = 0;
            for (int i = 0; i < n; i++) {
                String str = sc.next();
                String[] ab = str.split(",");
                int a = Integer.parseInt(ab[0]) - 1;
                temp = values[a];
                values[a] = values[Integer.parseInt(ab[1]) - 1];
                int b = Integer.parseInt(ab[1]) - 1;
                values[b] = temp;
            }
            for(int i = 0; i < w; i++){
                System.out.println(values[i]);
            }
        }
    }
}


Measured memory_bytes: 26072
#include <stdio.h>
int main(int argc, char const *argv[])
{
  int num,a,b;
  scanf("%d",&num);
  scanf("%d",&a);
  scanf("%d",&b);
  int i;
  int l,n,m,o,p,q,r,s;
  int sum=0;
  int c=0;
  l=num/10000;//
  m=num%10000;
  n=m/1000;//
  o=m%1000;
  p=o/100;//
  q=o%100;
  r=p/10;//
  s=p%10;//
  for(i=1;i<num+1;i++){
    l=i/10000;//
    m=i%10000;
    n=m/1000;//
    o=m%1000;
    p=o/100;//
    q=o%100;
    r=q/10;//
    s=q%10;//
    sum=l+n+p+r+s;
    if(a<=sum && sum<=b) c+=i;
  }
  printf("%d",c);
  return (0);
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline


N, M = map(int, input().split())
graph = [[] for _ in range(N)]
for _ in range(M):
    a, b, d = map(int, input().split())
    graph[a-1].append((b-1, d))
    graph[b-1].append((a-1, d))


defined_n = 0
ok = True
even = True
Color = [-1]*N
D = [0]*N
c = 0
q = [0]
Color[0] = 0
while q:
    qq = []
    c ^= 1
    for p in q:
        for np, d in graph[p]:
            if Color[np] == -1:
                Color[np] = c
                D[np] = d - D[p]
                qq.append(np)
            elif Color[np] != c:
                if (d-D[p]-D[np]) % 2 != 0:
                    ok = False
                    break
                if c == 1:
                    defined_n = (d-D[p]-D[np])//2
                else:
                    defined_n = (D[np]+D[p]-d)//2
                even = False
                break
            elif D[np] != d-D[p]:
                ok = False
                break
        if not ok or not even: break
    if not ok or not even: break
    q = qq

if not ok:
    print(0)
elif not even:
    if defined_n <= 0:
        ok = False
    q = [0]
    score = [-1]*N
    score[0] = defined_n
    while q:
        qq = []
        for p in q:
            s = score[p]
            for np, d in graph[p]:
                if score[np] == -1:
                    if d-s <= 0:
                        ok = False
                        break
                    score[np] = d-s
                    qq.append(np)
                elif score[np] != d-s:
                    ok = False
                    break
            if not ok: break
        if not ok: break
        q = qq
    if not ok:
        print(0)
    else:
        print(1)
else:
    min_n = 0
    max_n = 10**14
    for n in range(N):
        if Color[n] == 0:
            min_n = max(-D[n], min_n)
        else:
            max_n = min(max_n, D[n])
    print(max(0, max_n-min_n-1))

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

int main(){
    int H,W;
    cin >> H >> W;

    while(H!=0&&W!=0){
        for(int a=0;a<W;a++){
            cout << '#';
        }
        cout << endl;

        for(int b=0;b<H-2;b++){
            cout << '#';
            for(int c=0;c<W-2;c++){
                cout << ".";
            }
            cout << '#' << endl;
        }

        for(int a=0;a<W;a++){
            cout << '#';
        }
        cout << endl;

        cout << endl;

        cin >> H >> W;
    }

    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define MID 0
#define LEFT 1
#define UP 2
#define RIGHT 3
#define DOWN 4
using namespace std;

#define rep(i, a, b) for(int i = (a); i < int(b); ++i)
#define rrep(i, a, b) for(int i = (a) - 1; i >= int(b); --i)
#define trav(it, v) for(auto &it : (v))
#define all(v) (v).begin(), (v).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define sz(x) (int)(x).size()

typedef double fl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;

ll x1, Y1, x2, y2;
vector<pair<ll, ll> > F;
map<int, int> M;

int main(){
	ios::sync_with_stdio(0);
	cin >> x1 >> Y1 >> x2 >> y2;
	if(x1 > x2){
		swap(x1, x2);
		swap(Y1, y2);
	}
	bool rev = 0;
	if(Y1 > y2){
		rev = 1;
		Y1 = -Y1;
		y2 = -y2;
	}
	int N;
	cin >> N;
	rep(i,0,N){
		ll X, Y;
		cin >> X >> Y;
		if(rev)
			Y = -Y;
		F.emplace_back(X, Y);
	}
	sort(all(F));
	M[Y1] = 0;
	rep(i,0,N){
		ll X = F[i].first;
		ll Y = F[i].second;
		if(X < x1 || X > x2 || Y < Y1 || Y > y2)
			continue;
		auto it = M.upper_bound(Y);
		assert(it != M.begin());
		--it;
		M[Y] = it->second+1;
		it = M.upper_bound(Y);
		if(it != M.end())
			M.erase(it);
	}
	auto it = M.upper_bound(y2);
	--it;
	int num = it->second;
	double ans = 100.0*(x2-x1+y2-Y1)+num*(5.0*M_PI-20.0);
	if(num > y2-Y1 || num > x2-x1){
		ans += 5.0*M_PI;
	}
	printf("%.13lf\n", ans);
}

Measured memory_bytes: 13548
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<bits/stdc++.h>
#pragma GCC optimize(2)
#define LOVE ios::sync_with_stdio(0)
#define Foru(i,a,b) for(int i=(a);i<=(b);++i)
#define File ifstream fin("G:\\QtCode\\data\\in.txt")
using namespace std;
//void slove(int question_num)
//{
//    while(question_num--)
//    {
//        int sum[200002]={0};
//        int n;
//        cin>>n;
//        set<int>ans;
//        int num[200002]={0};
//        for(int i=1;i<=n;i++)
//        {
//            cin>>num[i];
//            sum[i]+=sum[i-1]+num[i];
//        }
//        for(int i=2;i<n;i++)
//        {
//            set<int>temp;
//            for(int j=i;j<=n;j++)
//            {
//                temp.insert(sum[j]-sum[j-i]);
//            }
//            if(temp.count((1+i)*i/2))
//                ans.insert(i);
//        }
//        cout<<1;
//        for(int i=2;i<n;i++)
//        {
//            if(ans.count(i))
//                cout<<1;
//            else cout<<0;
//        }
//        cout<<1<<endl;

//    }
//    return;
//}
//void slove(int question_num)
//{
//    while(question_num--)
//    {
//        unsigned int n;cin>>n;
//        map<int,int,greater<int> >temp;
//        for(unsigned int i=1;i<=n;i++)
//        {
//            int kkk;cin>>kkk;
//            temp[kkk]++;
//        }
//        if(temp.size()==1)
//            cout<<0<<' '<<0<<' '<<0<<endl;
//        else
//        {
//            int medalnum=n/2;
//            int tot=0;
//            int ans[5]={0};
//            auto pos=temp.begin();
//            ans[1]=temp.begin()->second;
//            int flage=1;
//            for(;pos!=temp.end();pos++)
//            {
//                tot+=pos->second;
//                if(tot>medalnum)
//                {
//                    tot-=pos->second;
//                    break;
//                }
//            }
//            for(auto it=++temp.begin();it!=pos;it++)
//            {
//                if(ans[2]<=ans[1])
//                    ans[2]+=it->second;
//                else flage=0;
//                if(!flage)
//                {
//                    ans[3]+=it->second;
//                }
//            }
//            if(ans[3]<=ans[1])
//                cout<<0<<' '<<0<<' '<<0<<endl;
//            else
//                cout<<ans[1]<<' '<<ans[2]<<' '<<ans[3]<<endl;
//        }
//    }
//    return;
//}
void slove(int question_num)
{
    while (question_num--) {
        int a,b,c;
        cin>>a>>b>>c;
        if((a+b+c)>=22)
            cout<<"bust"<<endl;
        else cout<<"win"<<endl;
    }
}
int main()
{
    LOVE;
    //int n;cin>>n;
    slove(1);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
  int n;
  string str1, str2;
  int p1 = 0, p2 = 0;

  cin >> n;
  for( int i = 0; i < n; ++i){
    cin >> str1 >> str2;
    if( str1 > str2){
      p1 += 3;
    }else if( str1 < str2){
      p2 += 3;
    }else{
      ++p1;
      ++p2;
    }
  }
  cout << p1 << ' ' << p2 << endl;
  return 0;
}

Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define ll long long
#define tmp(x) std::cout<<"& "<<(x)<<" &\n"
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;

const int maxn=1e4+100;
const int mo=998244353;

int a[maxn];
int main(){
//	freopen("in.txt","r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,ans=0;
    cin>>n;
    rep(i,1,sqrt(n)) {
        rep(j,1,sqrt(n)) {
            rep(k,1,sqrt(n)){
                int tmp=i*i+j*j+i*j+j*k+k*k+i*k;
                if(tmp<=n)++a[tmp];
            }
        }
    }
    rep(i,1,n)cout<<a[i]<<endl;



return 0;
}

Measured memory_bytes: 3628
import sys
sys.setrecursionlimit(1000000)

MOD = 1000000007

def dfs(par, v, val):
    for child in edges[v]:
        if child != par:
            ways[child] = max(0, val)
            val -= 1
            dfs(v, child, nColors - 2)

nVertices, nColors = map(int, input().split())
edges = [[] for _ in range(nVertices + 1)]
for _ in range(nVertices - 1):
    u, v = map(int, input().split())
    edges[u].append(v)
    edges[v].append(u)

ways = [0] * (nVertices + 1)
ways[1] = nColors
dfs(0, 1, nColors - 1)
ret = 1
for w in ways[1:]:
    ret = (ret * w) % MOD
print(ret)

Measured memory_bytes: 88068
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string s,t;
    int i,n,r=0;
    cin>>s>>t;
    n=s.size();
    for(i=0;i<n;i++)
    {
        if(s[i]!=t[i])
        {
            r++;
        }
    }
    if(r==0)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    ll c = a + b;
    ll dev = n / c;
    ll mod = n % c <= a ? n%c : a;
    cout << dev*a+mod;
    return 0;
}

Measured memory_bytes: 256
class dice:
    def __init__(self,label):
        self.top, self.front, self.right, self.left, self.rear, self.bottom \
                = label
  
    def roll(self,op):
        if   op=='N': self.top, self.front, self.bottom, self.rear = \
                                self.front, self.bottom, self.rear , self.top
        elif op=='E': self.top, self.left , self.bottom, self.right = \
                                self.left , self.bottom, self.right, self.top
        elif op=='W': self.top, self.right, self.bottom, self.left = \
                                self.right, self.bottom, self.left , self.top
        elif op=='S': self.top, self.rear , self.bottom, self.front = \
                                self.rear , self.bottom, self.front, self.top
  
    def print_top(self): print(self.top)
    def print_right(self): print(self.right)
  
    def get_label(self):
        return [self.top, self.front, self.right, self.left, self.rear, self.bottom]
   
label = list(map(int,input().split()))
d0 = dice(label)
d1 = list(map(int,input().split()))
for op in 'EEENEEENEEESEEESEEENEEEN':
    if d0.get_label() == d1:
        print('Yes')
        break
    d0.roll(op)
else:
    print('No')


Measured memory_bytes: 5608
#include<bits/stdc++.h>
#define int long long
using namespace std;
int read(){
	int w=0,f=1;
	char c=' ';
	while(c<'0'||c>'9')c=getchar(),f=c=='-'?-1:f;
	while(c>='0'&&c<='9')w=w*10+c-48,c=getchar();
	return w*f;
}
signed main(){
	int a=read(),b=read(),c=read(),d=read();
	long long ans=a*c;
	if(a<=0 && c<=0) ans=max(ans,a*c);
	if(b>=0 && d>=0) ans=max(ans,b*d);
	ans=max(ans,b*c),ans=max(ans,a*d);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3616
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=1e5+5;
struct eg{int v,nx;}e[N<<1];int head[N],tot;
inline void add(R int u,R int v){e[++tot]={v,head[u]},head[u]=tot;}
ll res;int cnt[2],dis[N],deg[N],n,m,fl;
void dfs(int u,int d){
	dis[u]=d,++cnt[d];
	go(u)if(dis[v]==-1)dfs(v,d^1);
		else if(dis[v]!=d^1)fl=1;
}
int main(){
	scanf("%d%d",&n,&m);
	for(R int i=1,u,v;i<=m;++i){
		scanf("%d%d",&u,&v),add(u,v),add(v,u);
		++deg[u],++deg[v];
	}
	memset(dis,-1,(n+1)<<2);
	dfs(1,0);
	if(fl)return printf("%lld\n",(1ll*n*(n-1)>>1)-m),0;
	fp(i,1,n)res+=cnt[dis[i]^1]-deg[i];
	printf("%lld\n",res>>1);
	return 0;
}

Measured memory_bytes: 3584
#include<cstdio>
using namespace std;

int main(){
    int n; scanf("%d", &n);
    double ans = 0;
    if(n == 1) ans = 1.0000000000;
    else if(n % 2 == 0) ans = 0.5000000000;
    else{
      ans = (n-1)/2+1;
      ans = ans / n;
    }
  
    printf("%lf", ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(x) (x).begin(),(x).end()
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, a, b;
  cin >> n >> a >> b;
  cout << (n * a < b ? n * a : b) << endl;
}


Measured memory_bytes: 3592
from sys import stdin
input = lambda: stdin.readline().rstrip("\r\n")
from collections import defaultdict as vector, deque as que
inin = lambda: int(input())
inar = lambda: list(map(int,input().split()))
from heapq import heappush as hpush,heappop as hpop

a=inin()
print(a+a*a+a*a*a)

Measured memory_bytes: 64832
import java.util.Scanner;

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

		String[] alp = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};

		int i;
		for (i=0; i<25; i++) {
			if (alp[i].equals(str)){
				break;
			}
		}
		System.out.println(alp[i+1]);

	}
}

Measured memory_bytes: 22996
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long A = sc.nextLong();
        long B = sc.nextLong();

        if (A > B) {
            long tmp = B;
            B = A;
            A = tmp;
        }

        long gcd = gcd(A, B);
        int N = (int) Math.sqrt((double) gcd);

        int ans = 1;
        for (int i = 2; i <= N; i++) {
            if (gcd % i == 0) {
                ans++;
                while (gcd % i == 0) {
                    gcd = gcd / i;
                }
            }
        }
        if (gcd != 1) {
            ans++;
        }

        System.out.println(ans);
    }

    static long gcd(long x, long y) {
        return y > 0 ? gcd(y, x % y) : x;
    }
 
}

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

#define IOS cin.tie(0);ios::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?' ':'\n'); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);}//最小公倍数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

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

const int NMAX = 200;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

signed main(){
    IOS;
    CIN(N,M,X,Y);
    vi x(N),y(M);
    rep(i,N)cin>>x[i];
    rep(i,M)cin>>y[i];
    flag=false;
    RepS(i,X+1,Y){
        if(*max_element(all(x))<i&&*min_element(all(y))>=i) {flag=true;break;}
    }
    printf(flag?"No War":"War");

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int N;
	cin >> N;
	int A[1000001];
	rep1(i, N) {
		cin >> A[i];
	}

	int kari = A[0];
	rep1(i, N) {
		kari = __gcd(kari, A[i]);
	}

	if (kari != 1) {
		co("not coprime");
		return 0;
	}

	unordered_map<int, int> MP;
	rep1(i, N) {
		int sq = sqrt(A[i]);

		int tmp = A[i];
		for (int j = 2; j <= sq; j++) {
			while (tmp % j == 0) {
				tmp /= j;

				if (MP[j] && MP[j] < i) {
					co("setwise coprime");
					return 0;
				}
				MP[j] = i;
			}
		}
		if (tmp != 1) {
			if (MP[tmp] && MP[tmp] < i) {
				co("setwise coprime");
				return 0;
			}
			MP[tmp] = i;
		}
	}
	co("pairwise coprime");



	Would you please return 0;
}

Measured memory_bytes: 7492
#include<stdio.h>
#include<algorithm>
int main()
{
	int n,m,X,Y,x[201],y[201],i;
	scanf("%d%d%d%d",&n,&m,&X,&Y);
	for(i=0;i<n;i++){
		scanf("%d",&x[i]);
	}
	for(i=0;i<m;i++){
		scanf("%d",&y[i]);
	}
	std::sort(x,x+n);
	std::sort(y,y+m);
	int z,a=0;
	for(z=x[n-1]+1;z<=y[0];z++){
		if(X<z && z<=Y)
			a=1;
	}
	if(a==1){
		printf("No War");
	}
	else{
		printf("War");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;

int main()
{
	int N;
	int C = 0;
	vector<int> A, B;
	cin >> N;
	A.resize(N);
	B.resize(N);
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	B = A;
	sort(B.begin(), B.end());
	for(int i = 0; i < N;i++)
	{
		if (A[i] != B[i])
		{
			C++;
		}
	}
	if(C<=2)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}

	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;

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

int main(){
	//input
	string s; cin>>s;
	if(s=="Sunny") cout<<"Cloudy";
	else if(s=="Cloudy") cout<<"Rainy";
	else cout<<"Sunny";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main()
{
  int n,m,num,i,ans=0,pl=0;
  int cl[100000],bad[100000];
  string str;
  
  cin>>n>>m;
  for(i=0;i<n;i++){
    cl[i]=bad[i]=0;
  }
  for(i=0;i<m;i++){
    cin>>num>>str;
    if(str=="AC"){
      if(cl[num-1]==0){
        cl[num-1]=1;
        ans++;
      }
    }else{
      if(cl[num-1]==0){
        bad[num-1]++;
      }
    }
  }
  for(i=0;i<n;i++){
    if(cl[i]>0){
      pl+=bad[i];
    }
  }
  cout<<ans<<" "<<pl<<endl;
  return 0;
}


Measured memory_bytes: 1024
import java.io.*;

class Main {
    BufferedReader bf;
    PrintWriter writer;
    StringBuilder sb;
    static boolean local_system = false;

    void run() throws IOException {
        int t = getInt();
        int[] h = new int[4];
        while(t-->0) add(bf.readLine().trim(),h);
        writer.println(get(h));
    }

    void add(String s,int[] h){
        if(s.equals("AC")) h[0]++;
        else if(s.equals("WA")) h[1]++;
        else if(s.equals("TLE")) h[2]++;
        else if(s.equals("RE")) h[3]++;
    }
    String get(int[] h){
        StringBuilder sb = new StringBuilder();
        sb.append("AC x "+h[0]).append("\n");
        sb.append("WA x "+h[1]).append("\n");
        sb.append("TLE x "+h[2]).append("\n");
        sb.append("RE x "+h[3]).append("\n");
        return sb.toString().trim();
    }

    public static void main(String[] args) throws IOException {
        long start_time = System.currentTimeMillis();
        Main obj = new Main();
        obj.run();
        long end_time = System.currentTimeMillis();
        if (local_system) obj.writer.println("Time : " + (end_time - start_time));
        obj.close();
    }

    public Main(){
        writer = new PrintWriter(System.out);
        bf = new BufferedReader(new InputStreamReader(System.in));
        sb = new StringBuilder();
    }

    public int getInt() throws IOException {
        return Integer.parseInt(bf.readLine());
    }

    public long getLong() throws IOException {
        return Long.parseLong(bf.readLine());
    }

    public int[] ints() throws IOException {
        String[] data = bf.readLine().split(" ");
        int[] send = new int[data.length];
        for (int i = 0, h = data.length; i < h; i++) send[i] = Integer.parseInt(data[i]);
        return send;
    }

    public long[] longs() throws IOException {
        String[] data = bf.readLine().split(" ");
        long[] send = new long[data.length];
        for (int i = 0, h = data.length; i < h; i++) send[i] = Long.parseLong(data[i]);
        return send;
    }

    public void close() throws IOException{
        writer.flush();
        writer.close();
        bf.close();
    }
}




Measured memory_bytes: 34084
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int A[100010];
    rep(i, N) cin >> A[i];
    map<int, int> mp;
    rep(i, N) mp[A[i]]++;
    set<int> st;
    rep(i, N) if (mp[A[i]] % 2 == 1) st.insert(A[i]);
    cout << st.size() << endl;

    return 0;
}


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

class Dinic {
private:
	struct Edge {
		int to, cap, rev;
		Edge(int t, int c, int r) :to(t), cap(c), rev(r) {}
	};
	int V;
	std::vector<std::vector<Edge>> graph;
	std::vector<int> level, iter;

public:
	Dinic(int v) : V(v) {
		graph.resize(v);
		level.resize(v, -1);
		iter.resize(v, 0);
	}
	// fromからtoへ向かう容量capの辺をグラフに追加する
	void addEdge(int from, int to, int cap) {
		graph[from].emplace_back(to, cap, graph[to].size());
		graph[to].emplace_back(from, 0, graph[from].size() - 1);
	}

	// sからの最短距離をBFSで計算する
	void bfs(int s) {
		std::fill(level.begin(), level.end(), -1);
		std::queue<int> queue;
		level[s] = 0;
		queue.push(s);
		while (!queue.empty()) {
			int v = queue.front(); queue.pop();
			for (int i = 0; i < graph[v].size(); ++i) {
				Edge& e = graph[v][i];
				if (e.cap > 0 && level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					queue.push(e.to);
				}
			}
		}
	}

	// 増加パスをDFSで探す
	int dfs(int v, int t, int f) {
		if (v == t) return f;
		for (int& i = iter[v]; i < graph[v].size(); ++i) {
			Edge& e = graph[v][i];
			if (e.cap > 0 && level[v] < level[e.to]) {
				int d = dfs(e.to, t, std::min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					graph[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}

	// sからtへの最大流を求める
	int maxflow(int s, int t) {
		int res = 0;
		while (true) {
			bfs(s);
			if (level[t] < 0) return res;
			std::fill(iter.begin(), iter.end(), 0);
			int f;
			while ((f = dfs(s, t, (1LL << 31) - 1)) > 0) {
				res += f;
			}
		}
	}
};
char s[100][101];
int a[100][100];
int main() {
	int h, w; scanf("%d%d", &h, &w);
	int cnt = 2;
	rep(i, h) {
		scanf("%s", s[i]);
		rep(j, w) {
			if (s[i][j] == 'T')a[i][j] = 1;
			if (s[i][j] == 'o')a[i][j] = cnt++;
		}
	}
	Dinic b(cnt * 2);
	rep(i, cnt)b.addEdge(i * 2, i * 2 + 1, 1);
	rep(i, h)rep(j, w) {
		if (s[i][j] == '.')continue;
		rep(k, h) {
			if (s[k][j] != '.')b.addEdge(a[i][j] * 2 + 1, a[k][j] * 2, INF);
		}
		rep(k, w) {
			if (s[i][k] != '.')b.addEdge(a[i][j] * 2 + 1, a[i][k] * 2, INF);
		}
	}
	int c = b.maxflow(1, 2);
	if (c >= INF)puts("-1");
	else printf("%d\n", c);
}

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

typedef complex<int> point;
typedef long long int lli;
typedef long double ld;
#define pii pair<int,int>
#define lasB(b) (b&(-b))
#define pld pair<ld,ld>
#define mod 1000000007
#define PI acos(-1.0)
#define PB push_back
#define N   1000006
#define EPS (1e-8)
#define ss substr
#define S second
#define IM image
#define F first
#define RE real
#define B begin
#define E end

lli n,x,sol,acc;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>x;
    int all[n];
    for(int i=0;i<n;i++ )
    {
        cin>>all[i];
    }
    sort(all,all+n);
    for(int i=0;i<n;i++)
    {
        if(i==n-1)
        {
            if(acc+all[i]==x)
                sol++;
            break;
        }
        if(acc+all[i]<=x)
        {
            sol++;
            acc+=all[i];
        }
        else break;
    }
    cout<<sol;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define Rrep(i,n) for(int i=((int)n-1); i>=0; i--)
#define all(x) (x).begin(),().end()
#define SZ(x) ((int)(x).size())
typedef long long ll;



int main ()
{
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(15);

        char C;
        cin>>C;

        printf("%c\n",C+1);

        return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;
int main() {
	int N;
	string ptr;
	cin>>N>>ptr;
	for(int i=0;i<ptr.length();i++){
		ptr[i]=(ptr[i]+N);
		if(ptr[i]>'Z'){
			ptr[i]=ptr[i]-26;
		}
	}
//	cout<<ptr.length()<<endl;
//	ptr[0]=ptr[0]+N;
	cout<<ptr<<endl;
    return 0;
}

Measured memory_bytes: 256
n,c,k=map(int,input().split())
t=[0 for i in range(n)]
for i in range(n):
    t[i]=int(input())
t.sort()
ans=0
cnt=1
bef=t[0]
for i in range(1,n):
    if cnt==c:
        ans+=1
        cnt=1
        bef=t[i]
    elif bef+k>=t[i] and cnt<c:
        cnt+=1
    else:
        ans+=1
        cnt=1
        bef=t[i]
    if i==n-1:
        ans+=1
print(ans)


Measured memory_bytes: 45600
M = int(input())
a = list(map(int,input().split()))
a = [None]+a
b = [M-k for k in range(M)]
c = [0 for k in range(M+1)]
h = 0
for s in b:
	w = M // s
	wa = 0
	for k in range(w-1):
		wa += c[s*(k+2)]
	if wa % 2 == a[s]:
		c[s] = 0
	else:
		c[s] = 1
		h += 1
print(h)
for k in range(1,len(c)):
	if c[k] == 1:
		print(k, end=" ")

Measured memory_bytes: 15108
#include <bits/stdc++.h>
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;

#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for (int i=(a); i<(b); ++i)
#define FORD(i,a,b) for (int i=(a)-1; i>=(b); --i)

#define pb push_back
#define mp make_pair
#define st first
#define nd second

const int MOD = 1000000007;

char S[2005];
vector<int> adj[2005];

typedef tuple<LL, LL, LL> Res;

Res go(int v, int p = -1) {
  Res result(S[v]-'0', 0, 0);

  vector<Res> recs;
  for (auto u: adj[v]) if (u != p) {
    recs.pb(go(u, v));
  }

  for (auto& rec: recs) {
    get<1>(rec) += get<0>(rec);
    get<2>(rec) += get<0>(rec);

    get<0>(result) += get<0>(rec);
    get<1>(result) += get<1>(rec);
  }

  if (recs.size()) {
    auto r = *max_element(recs.begin(), recs.end(), [](Res a, Res b) {
      return get<1>(a) < get<1>(b);
    });
    LL s = 0;
    for (auto rec: recs) {
      s += get<1>(rec);
    }
    s -= get<1>(r);
    get<2>(result) = max(0LL, get<2>(r) - s);
    get<2>(result) = max(get<2>(result), get<1>(result) % 2);
  }

  // printf("!!%d %d %d %d\n", v, get<0>(result), get<1>(result), get<2>(result));
  return result;
}

int main() {
  // ios_base::sync_with_stdio(0);

  int N;
  scanf("%d%s", &N, S);
  REP(i,N-1) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    adj[a].pb(b);
    adj[b].pb(a);
  }

  LL res = 1e18;
  REP(i,N) {
    auto r = go(i);
    // printf("%d %d %d %d\n", i, get<0>(r), get<1>(r), get<2>(r));
    if (get<1>(r) % 2 == 0 && !get<2>(r)) {
      res = min(res, get<1>(r) / 2);
    }
  }
  if (res == 1e18) {
    res = -1;
  }
  printf("%lld\n", res);

}


Measured memory_bytes: 640
<?php
// Your code here!
$insert = array();
$insert = str_split(trim(fgets(STDIN)));
$count = 0;

foreach($insert as $val){
    if($val % 7 == 0 && $val != 0){
        $count++;
    }
}

if($count == 0){
    echo "No".PHP_EOL;
}else{
    echo "Yes".PHP_EOL;
}


Measured memory_bytes: 16184
#include <cstdio>

int main()
{
  int d, a, b;
  scanf("%d", &d);
  a = d / 100;
  b = d % 100;
  int ans = (1 <= b && b <= 12 ? 1 : 0) | (1 <= a && a <= 12 ? 2 : 0);
  puts(ans == 0 ? "NA" : ans == 1 ? "YYMM" : ans == 2 ? "MMYY" : "AMBIGUOUS");
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const ll MOD = 1e9+7;


#define REP(i, N) for (ll i = 0; i < (N); i++)
#define REPP(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((ll)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<ll>>

using namespace std;


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

    int N,X,Y;
    cin >> N >> X >> Y;
    vector<ll> ans(N,0);
    ll count_under = X-1,count_over = N-Y;

    vector<ll> count_to_X(N,0),count_to_Y(N,0);

    if((Y-X+1)%2 == 0){
        for(ll i = 1; i < (Y-X+1)/2;i++){
            ans[i] += (Y-X+1);
        }
        ans[(Y-X+1)/2] += (Y-X+1)/2;
    }else{
        for(ll i = 1; i < (Y-X+1)/2+1;i++){
            ans[i] += (Y-X+1);
        }
    }

    for(ll i = X; i < Y+1;i++){
        int idx = min(i-X,Y-i+1);
        int idy = min(Y-i,i-X+1);
        count_to_X[idx]++;
        count_to_Y[idy]++;
    }
        
    for(ll i = 1; i < X;i++){
        for(ll l = 1; l < (Y-X+1)/2+1;l++){
            ans[i+l] += count_to_X[l];
        }
    }

    for(ll i = Y+1; i < N+1;i++){
        for(ll l = 1; l < (Y-X+1)/2+1;l++){
            ans[i-Y+l] += count_to_Y[l];
        }
    }
    
    for(ll i = 1; i < X;i++){
        ans[i] += X-i;
    }
    

    for(ll i = Y+1; i < N+1;i++){
        ans[i-Y] += (N+1-Y)-(i-Y);
    }

    for(ll i = 1; i < X;i++){
        for(ll l = 1; l < N-Y+1;l++){
            ans[i+l+1]++;
        }
    }


    for(ll i = 1; i < N;i++){
        cout << ans[i] << endl;
    }

    return 0;
}

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

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

    int w[n], sorted[n], minimum = 10000;
    bool visited[n];
    for (int i = 0; i < n; i++)
    {
        cin >> w[i];
        sorted[i] = w[i];
        visited[i] = false;
        minimum = min(minimum, w[i]);
    }

    sort(sorted, sorted + n);
    int inv[10001];
    for (int i = 0; i < n; i++)
        inv[sorted[i]] = i;

    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (visited[i])
            continue;
        int sum = 0, c = 0, minw = 10000, j = i;
        while (!visited[j])
        {
            sum += w[j];
            c++;
            minw = min(minw, w[j]);
            visited[j] = true;
            j = inv[w[j]];
        }
        ans += min(sum + (c - 2) * minw, sum + minw + (c + 1) * minimum);
    }

    cout << ans << endl;
}


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

int main()
{
    long long num,sum=0;

    cin>>num;

    for(int i=1; i<=num; i++)
    {
        if(i%3!=0 && i%5!=0)
        {
            sum+=i;
        }
    }

    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
using namespace std;
int main() {
  int H,W;
  cin >>H>>W;
  char a[110][110];
  for(int i=0;i<H;i++)
  for(int j=0; j<W;j++)
  cin >> a[i][j];

  int index1[110]={0};
  int index2[110]={0};
  for(int i=0;i<H;i++){
    int count=0;
  for(int j=0; j<W;j++){
  if(a[i][j]=='.') count++;
  }
  if(count==W) index1[i]++;
  }


  for(int i=0;i<W;i++){
    int count=0;
  for(int j=0; j<H;j++){
  if(a[j][i]=='.') count++;
  }
  if(count==H) index2[i]++;
  }

  for(int i=0;i<H;i++){
  for(int j=0; j<W;j++){
    if(index1[i]==0 && index2[j]==0) cout <<a[i][j];
  }
  if(index1[i]==0)
  cout <<endl;
}

}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	int s[10000];
	int q, t;
	int c=0;
	cin>>n;
	for(int i=0; i<n; i++) cin>>s[i];
	cin>>q;
	for(int i=0; i<q; i++) {
		cin>>t;
		for(int j=0; j<n; j++) {
			if(s[j]==t) {
				++c;
				break;
			}
		}
	}
	cout<<c<<'\n';
	return 0;
}



Measured memory_bytes: 3208
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

typedef long long ll;
const ll mod = 1e9+7;


vector<int> edges[100005];
vector<vector<ll>> dp(100005,vector<ll> (2));
void dfs(int s,int p){
	dp[s][0] = 1;
	dp[s][1] = 1;
	for(auto x:edges[s]){
		if(x != p){
			dfs(x,s);
			dp[s][0] *= (dp[x][0] + dp[x][1]);
			dp[s][0] %= mod;
			dp[s][1] *= (dp[x][0]);
			dp[s][1] %= mod;
		}
	}

}
int main(int argc, const char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n,i,x,y;
    cin>>n;
    for(i=1;i<n;++i){
    	cin>>x>>y;
    	edges[x].push_back(y);
    	edges[y].push_back(x);
    }
    dfs(1,-1);
    cout<<(dp[1][0] + dp[1][1])%mod <<"\n";

    
#ifndef LOCAL_DEFINE
    cerr << "Time elapsed: "<< 1e1 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif // LOCAL_DEFINE
    return 0;
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t h, w, k;
    cin >> h >> w >> k;

    vector<vector<bool>> m(h);
    for (auto&& r : m) {
        string s;
        cin >> s;

        for (auto c : s) {
            r.push_back(c == '#');
        }
    }

    int64_t ans = 0;
    for (auto s : irange(0uL, 1uL << (h + w))) {
        bitset<6> hb(s & ((1uL << h) - 1));
        bitset<6> wb(s >> h);

        int64_t t = 0;
        for (auto i : irange(0L, h)) {
            if (hb[i]) {
                continue;
            }
            for (auto j : irange(0L, w)) {
                if (wb[j]) {
                    continue;
                }

                if (m[i][j]) {
                    ++t;
                }
            }
        }

        if (t == k) {
            ++ans;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.000001
#define pi 3.141592653589793
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti multiset <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define stp setprecision(20)//use fixed before stp
#define endl '\n'
ll a[2000000];
int main()
{  
    FAST
    ll n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    s[k-1]=(char)(s[k-1]+32);
    cout<<s;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <functional>
#include <cstring>
using namespace std;

long long int n, k, a[100000], b[64], dp[61][2];


long long int f(int p, bool b) {
  if(p < 0)
    return 0;
  if(dp[p][b] != -1)
    return dp[p][b];
  long long sol = 0;
  if(b) {
    sol = max(sol, (1ll << p) * ::b[p] + f(p - 1, true));
    sol = max(sol, (1ll << p) * (n - ::b[p]) + f(p - 1, true));
  } else {
    if(k & (1ll << p))
      sol = max(sol, (1ll << p) * (n - ::b[p]) + f(p - 1, false));
    sol = max(sol, (1ll << p) * ::b[p] + f(p - 1, (bool)(k & (1ll << p))));
  }
  return dp[p][b] = sol;
}

int main() {
  cin >> n >> k;
  for(int i = 0; i < n; ++i) {
    cin >> a[i];
    for(int j = 0; j < 63; ++j)
      if((1ll << j) & a[i])
        ++b[j];
  }
  memset(dp, -1, sizeof dp);
  cout << f(60, 0) << endl;
}

Measured memory_bytes: 1024
from collections import defaultdict
N,M=map(int,input().split())
A=[int(i) for i in input().split()]
P=[0]*(N+1)
for i in range(N):
    P[i+1]=P[i]+A[i]
dd=defaultdict(int)
for p in P:
    dd[p%M]+=1
ans=0
def dou(x):
    return (x*(x-1))//2
for s in dd.values():
    ans+=dou(s)
print(ans)

Measured memory_bytes: 62576
def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        if sum < g:
            use = max(nokori)
            n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = min(ans, count)

    else:
        dfs(i+1, sum, count, nokori)
        dfs(i+1, sum+pc[i][0]*(i+1)*100+pc[i][1] +
            pc[i][0], count + pc[i][0], nokori-{i+1})


d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = float("inf")

dfs(0, 0, 0, set(range(1, d+1)))
print(ans)


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


int main(){
  int n;
  cin >> n;
  int a[n],b[n];
  rep(i,n){
    cin >> a[i];
    b[i]=a[i];
    a[i] -= i;
  }
  sort(a,a+n);
  ll ans=0;
  int med;
  if(n%2==0){
    med = (a[n/2-1]+a[n/2])/2;
  }else{
    med = a[n/2];
  }
  rep(i,n)ans += abs(b[i]-(med+i));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
const int mod=1e9+7;
using namespace std;
string s;
stack<char> st;
void put()
{
    if(st.empty()) return ;
    char r=st.top();st.pop();
    put();
    cout<<r;
}
int main()
{
    //freopen("input.txt","r",stdin);
    ios::sync_with_stdio(false);
    cin>>s;
    for(char t:s)
    {
        if(t=='B'&&!st.empty()) st.pop();
        if(t!='B')
            st.push(t);
    }
    put();

}



Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 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;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            long k = Long.parseLong(in.next());
            long ans = 0;
            long[] seq = new long[100001];
            int a = 0;
            long b = 0;
            for (int i = 0; i < n; i++) {
                a = Integer.parseInt(in.next());
                b = Long.parseLong(in.next());
                seq[a] += b;
            }
            for (int i = 1; i <= 100000; i++) {
                if (k <= seq[i]) {
                    ans = i;
                    break;
                }
                k -= seq[i];
            }

            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 59860
import sys
sys.setrecursionlimit(10**7)

def dfs(sx,sy):
  stack=[[sx,sy]]
  while(stack):
    x,y=stack.pop()
 
    move=[[x,y],[x,y-1],[x,y+1],[x+1,y],[x-1,y],[x-1,y-1],[x+1,y+1],[x+1,y-1],[x-1,y+1]]
 
    for mx,my in move:
      if not(0<=mx<=h-1) or not(0<=my<=w-1):
        continue

      elif l[mx][my]==1:
        stack.append([mx,my])
        l[mx][my]=0

while(True):
  w,h=[int(x) for x in input().rstrip().split()]
  if w==h==0:
    break

  l=[]
  for i in range(h):
    c=[int(x) for x in input().rstrip().split()]
    l.append(c)
    
  ans=0
  for i in range(h):
    for j in range(w):
      if l[i][j]==1:
        dfs(i,j)
        ans+=1
  print(ans)





Measured memory_bytes: 5628
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	string s = S.substr(4);
	s = "2018" + s;

	cout << s << endl;
}

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

using namespace std;

int x, a;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> x >> a;
    if (x < a) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
    return 0;
}


Measured memory_bytes: 764
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int a[101];
int cnt[101]={};
bool f(){
	int N;
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> a[i];
	}
	sort(a,a+N);
	int m=a[N-1];
	if(m==1){
		if(N==2){
			return true;
		}
		else{
			return false;
		}
	}
	int l=(m+1)/2;
	for(int i=0;i<N;i++){
		if(a[i]<l){
			return false;
		}
		cnt[a[i]]++;
	}
	if(m%2==0){
		cerr << a[l] << endl;
		if(cnt[l]!=1){
			return false;
		}
		for(int i=l+1;i<=m;i++){
			if(cnt[i]<2){
				return false;
			}
		}
	}
	else{
		if(cnt[l]!=2){
			return false;
		}
		for(int i=l+1;i<=m;i++){
			if(cnt[i]<2){
				return false;
			}
		}
	}
	return true;
}

int main() {

	if(f()){
		cout << "Possible" << endl;
	}
	else{
		cout << "Impossible" << endl;
	}


	return 0;
}



Measured memory_bytes: 632
a, b = list(map(int, input().split()))

L = 100
l = L//2
ans = [['.']*L for _ in range(l)]
ans += [['#']*L for _ in range(l)]
# for a in ans: print(a)

for i in range(a-1):
    h = (i//l)*2 + l+1
    w = (i%l)*2
    ans[h][w] = '.'
for i in range(b-1):
    h = (i//l)*2
    w = (i%l)*2
    ans[h][w] = '#'

print(L, L)
for a in ans:
    print(''.join(a))


Measured memory_bytes: 3192