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

#define fa(x,v) for(auto x:v)
#define f(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define spc " "
#define endl '\n'
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(s) (ll)int(s.length())
#define sz(v) (ll)int(v.size())
#define MOD 1000000007

void Fast_IO() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    freopen("debug.out","w",stderr);
    #endif
} 

// Code Here

int main()
{
    // Fast_IO();
    ll n; cin >> n;
    if(n % 1000 == 0) cout << 0;
    else {
    	ll pay = (n / 1000 + 1) * 1000;
    	cout << pay - n;
    }
    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
using namespace std;
typedef long long LL;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
int fa[1010],v[1010];
int f[1010][5010];
const int inf=1<<25;
int main()
{
	int n=gi(),i,k,t,p,w;
	for (i=2;i<=n;i++) fa[i]=gi();
	for (i=1;i<=n;i++) v[i]=gi();
	for (k=n;k;k--) {
		for (i=0,t=inf;i<=v[k];i++) t=min(t,f[k][i]);
		if (t>(1<<20)) return puts("IMPOSSIBLE"),0;
		if (p=fa[k])
			for (i=v[p];i>=0;i--) {
				w=inf;
				if (i>=v[k]) w=min(w,f[p][i-v[k]]+t);
				if (i>=t) w=min(w,f[p][i-t]+v[k]);
				f[p][i]=w;
			}
	}
	puts("POSSIBLE");
	return 0;
}


Measured memory_bytes: 17792
#include <bits/stdc++.h>
#define ll uint64_t
#define vi vector <int>
#define vl vector <ll>
#define dl pair <ll, ll>
#define ii pair <ll, ll>
#define vii vector <ii>
#define graph vector <vector <int> >
#define REP(a, b) for (int i = a; i < b; i++)
#define REP2(a, b) for (int j = a; j < b; j++)
#define REPS(a, b, c) for (int i = a; i < b; i += c)
#define mod 1000000007
 
using namespace std;
 
int main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
 
    ll n;
    cin >> n;
    ll dp[n];
    dp[0] = dp[1] = dp[2] = 0;
    for (ll i = 3; i <= n; i++) {
    	dp[i] = 1;
    	for (ll j = 3; j < i; j++) {
    		dp[i] += dp[i - j];
    		dp[i] %= mod;
    	}
    }
    cout << dp[n] << "\n";
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <math.h>
int main()
{
  long long int N;
  long long int thr;
  long long int fiv;
  long long int fif;
  long long int ans;
  scanf("%lld", &N);
  thr = N / 3;
  fiv = N / 5;
  fif = N / 15;
  ans = ( N * ( N + 1 ) - 3 * thr * ( thr + 1 ) - 5 * fiv * ( fiv + 1 )
         + 15 * fif * ( fif + 1 ) ) / 2;
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 1736
n=int(input())
l=list(input().split())
ln=[]
m=0
for i in l:
  if int(i)%2==0:
    ln.append(int(i))
for k in ln:
  if k%3==0 or k%5==0:
    m=m+1
if m==len(ln):
  print("APPROVED")
else:
  print("DENIED")

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

int main()
{
  int N, M;

  cin >> N >> M;

  int ans = 0;

  ans = N >= 2 ? N * (N - 1) / 2 : 0;

  ans += M >= 2 ? M * (M - 1) / 2 : 0;

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 1e9+7;

vector<ll> fact,ifact,inv,pow2;
ll add(ll a,ll b)
{
	a%=MOD; b%=MOD;
	a+=b;a%=MOD;
	if(a<0) a+=MOD;
	return a;
}
ll mult(ll a, ll b)
{
	a%=MOD; b%=MOD;
	ll ans=(a*b)%MOD;
	if(ans<0) ans+=MOD;
	return ans;
}
ll pw(ll a, ll b)
{
	ll r=1;
	while(b){
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}
ll inverse(ll a)
{
	return pw(a,MOD-2);
}
ll choose(ll a, ll b)
{
	if(a<b) return 0;
	if(b==0) return 1;
	if(a==b) return 1;
	return mult(fact[a],mult(ifact[b],ifact[a-b]));
}
void init(ll _n)
{
	fact.clear(); ifact.clear(); inv.clear(); pow2.clear();
	fact.resize(_n+1); ifact.resize(_n+1); inv.resize(_n+1); pow2.resize(_n+1);
	pow2[0]=1; ifact[0]=1; fact[0]=1;
	for(int i=1;i<=_n;i++){
		pow2[i]=add(pow2[i-1],pow2[i-1]);
		fact[i]=mult(fact[i-1],i);
	}
	ifact[_n] = inverse(fact[_n]);
	for(int i=_n-1;i>=1;i--){
	    ifact[i] = mult(ifact[i+1], i+1);
	}
	for(int i=1;i<=_n;i++){
	    inv[i] = mult(fact[i-1], ifact[i]);
	}
}
void getpf(vector<ii>& pf, ll n)
{
	for(ll i=2; i*i<=n; i++)
	{
		int cnt=0;
		while(n%i==0){
			n/=i; cnt++;
		}
		if(cnt>0) pf.pb({i,cnt});
	}
	if(n>1) pf.pb({n,1});
}

const int MAXN = 100005;

ll X,Y;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	init(1e6+5);
	
	cin>>X>>Y;
	if(X>Y) swap(X,Y);
	
	ll cnt=0;
	while(Y>X && Y>0){
		Y-=2; X--;
		cnt++;
	}
	if(Y>X || X%3!=0){ cout<<0<<'\n'; exit(0); }
	
	cout<<choose(X/3*2+cnt, cnt+X/3)<<'\n';
	
	return 0;
}


Measured memory_bytes: 34576
import java.util.*;

class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String b = sc.next();
        Base(b);
        //System.out.println(Base());
    }
    private static void Base(String b){
        if(b.equals("A") || b.equals("C")){
            b = b.replace('A', 'T');
            b = b.replace('C', 'G');
        }else{
            b = b.replace('T', 'A');
            b = b.replace('G', 'C');
        }
        System.out.println(b);
    }
}

Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using data=pair<int,int>;
#define rep(i,N) for(i=0;i<N;i++)
#define rep1(i,N) for(i=1;i<N;i++)
#define mod 1000000007

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}
 
ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

int main(){
  ll i,j,k,N,K,calc,ans=2019;
  cin>>N>>K;
  if(K-N>=2019){cout<<"0"<<endl;return 0;}
  N=N%2019;K=K%2019;
  if(K<N){cout<<"0"<<endl;return 0;}
  for(i=N;i<K;i++){
    for(j=i+1;j<=K;j++){
      calc=i*j%2019;
      if(calc<ans)ans=calc;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)
d, x = read_line(int, int)

a = []
for i in range(n):
    ai, = read_line(int)
    a.append(ai)


sum = 0
for ai in a:
    sum += len(range(0, d, ai))

print(sum + x)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    unsigned long long INFF = 1e18;
    if(abs(a - b) >= INFF) cout << "Unfair" << endl;
    cout << (k % 2 == 0 ? a - b : -(a - b) )<< endl;
	return 0;
}



Measured memory_bytes: 256
#if 0
2019.09.08

首先括号只有放在减号右边才有影响，这里规定只能有这样的括号。
朴素 DP 设 f[i][j] 表示前 i 个数构成式子中有 j 个左括号未匹配的答案。
转移枚举 f[i - 1][k] ，考虑在第 i 数后面放几个右括号，如果是减号还能加一个左括号。
这样做是 O(n^2) 的，但事实上 f 的第二维只有 0/1/2 可能最终贡献到答案，于是 O(n) 。
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long lolong;

inline int input() { int x; scanf("%d", &x); return x; }

const int maxn = 200005, maxm = 5;
int a[maxn], b[maxn];
lolong f[maxn][maxm];

int main() {
	int n = input();

	a[1] = '+';
	b[1] = input();
	for(int i = 2; i <= n; i ++) {
		a[i] = getchar();
		while(a[i] != '-' and a[i] != '+')
			a[i] = getchar();
		b[i] = input();
		if(a[i] == '-')
			b[i] *= -1;
	}
	a[n + 1] = '-';
	b[n + 1] = 0;

	int m = 2;
	for(int j = 1; j <= m; j ++)
		f[0][j] = - 1000000000000000000;

	for(int i = 1; i <= n; i ++) {
		for(int j = 0; j <= m; j ++) {
			f[i][j] = - 1000000000000000000;
			for(int k = j; k <= m; k ++)
				f[i][j] = std::max(f[i][j],
						f[i - 1][k] + (k & 1 ? - b[i] : b[i]));
			if(a[i] == '-' and j)
				f[i][j] = std::max(f[i][j],
						f[i - 1][j - 1] + (j & 1 ? b[i] : - b[i]));
			/* if(f[i][j] >= - 100) */
				/* debug(" %lld", f[i][j]); */
			/* else */
				/* debug(" @"); */
		}
		/* debug("\n"); */
	}

	printf("%lld\n", f[n][0]);
}


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

char c[10][10];

int main () {

	for (int i = 0; i < 3; i ++) {
		for (int j = 0; j < 3; j ++) {
			cin >> c[i][j];
		}
	}
	cout << c[0][0] << c[1][1] << c[2][2];

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  public static void main(String[]args){
    Scanner scan=new Scanner(System.in);
    String S=scan.next();
   if(S.equals("Sunny")){
     System.out.println("Cloudy");
     }
   if(S.equals("Cloudy")){
     System.out.println("Rainy");
     }
   if(S.equals("Rainy")){
     System.out.println("Sunny");
     }
  }
}

Measured memory_bytes: 20052
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define lint long long
using namespace std;
int readint() {
	char c = getchar_unlocked();
	int ans = 0;
	while ('0' <= c && c <= '9') {
		ans = ans * 10 + c - '0';
		c = getchar_unlocked();
	}
	return ans;
}
lint readlint() {
	char c = getchar_unlocked();
	lint ans = 0;
	while ('0' <= c && c <= '9') {
		ans = ans * 10 + c - '0';
		c = getchar_unlocked();
	}
	return ans;
}
char ch[1024];
void writeint(lint x) {
	int ptr = 0;
	while (x) {
		ch[ptr++] = (x % 10) + '0';
		x /= 10;
	}
	while (ptr) {
		putchar_unlocked(ch[--ptr]);
	}
	putchar_unlocked(' ');
}
int q;
constexpr int mod=1000000007;
lint x,y,a,n,m;
constexpr lint f[]={0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352,24157817,39088169,63245986,102334155,165580141,267914296,433494437,701408733,1134903170,1836311903,2971215073,4807526976,7778742049,12586269025,20365011074,32951280099,53316291173,86267571272,139583862445,225851433717,365435296162,591286729879,956722026041,1548008755920,2504730781961,4052739537881,6557470319842,10610209857723,17167680177565,27777890035288,44945570212853,72723460248141,117669030460994,190392490709135,308061521170129,498454011879264,806515533049393,1304969544928657,2111485077978050,3416454622906707,5527939700884757,8944394323791464,14472334024676221,23416728348467685,37889062373143906,61305790721611591,99194853094755497,160500643816367088,259695496911122585,420196140727489673,679891637638612258,1100087778366101931};
int main(){
	q=readint();
	rep(i,q){
		x=readlint();y=readlint();
		if(x>y)swap(x,y);
		if(y<=2){
			writeint(1);writeint(y==1?1:x==1?2:4);
			continue;
		}
		rep(j,99){
			if(x<f[j]||y<f[j+1]){
				a=(x==1?2:1);
				rep(k,j-2){
					n=f[j-1]+f[j-3-k]*f[k+2],m=f[j]+f[j-2-k]*f[k+2];
					if(n<=x&&m<=y)a+=(y-m)/n+1;
				}
				if(f[j]<=x){
					a++;
					rep(k,j-2)a+=(x-f[j])/(f[j-2-k]*f[k+2]);
				}
				writeint(j-2);writeint(a%mod);
				break;
			}
		}
	}
}

Measured memory_bytes: 4320
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std; 

inline void solve(){ 
    int  r, c, odd = 0 ; 
    cin >> r >> c ; 
    vector <vector <int> > g(r+5,vector <int> (c+5)); 
    for (int i=1;i<=r;i++) { 
    	for (int j=1;j<=c;j++) { 
    		cin >> g[i][j] ; 
    		g[i][j] = ( (g[i][j] & 1)? 1 : 0 ) ; 
    	} 
    } 
    vector <pair<pii,pii>> res; 
    pair <pii,pii> p;
    for (int i=1;i<=r;i++){
    	for (int j=1;j<c;j++){
    		if (g[i][j]&1) {
    			g[i][j+1]++;
    			p.ff.ff=i; p.ff.ss=j;
    			p.ss.ff=i; p.ss.ss=j+1;
    			res.pb(p);
    		}
    	}
    }
    for (int i=1;i<r;i++){
    	if (g[i][c]&1){
    		g[i+1][c]++;
    		p.ff.ff=i; p.ff.ss=c;
    		p.ss.ff=i+1; p.ss.ss=c;
    		res.pb(p);
    	}
    }
    cout << sz(res) << endl;
    for (auto &it: res) {
    	printf("%lld %lld %lld %lld\n",it.ff.ff,it.ff.ss,it.ss.ff,it.ss.ss);
    }
} 

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}
/*
2 3
1 2 3
0 1 1


3 2
1 0
2 1
1 0

1 5
9 9 9 9 9

*/

Measured memory_bytes: 9464
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
int main(){
    
    int N,K;
    cin >> N >> K;
    vector<int> H(N);
    
    rep(i,N){
        cin >> H[i];
    }
    
    sort(H.begin(),H.end());
  	reverse(H.begin(),H.end());
    
    ll ans = 0;
    if(N>K){
        for(ll i = 0;i<N-K;i++){
            ans += H[i + K ];
        }
        cout << ans << endl;
    }
    
    else {
        intput(0);
    }
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
//#include<bits/extc++.h>
//using namespace __gnu_pbds;
using namespace std;
#define F(i,L,R) for (int i = L; i < R; i++)
#define FE(i,L,R) for (int i = L; i <= R; i++)
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define VgetI(n) int (n); scanf("%d",&(n))
#define VgetII(n,m) int (n),(m); scanf("%d %d",&(n),&(m))
#define VgetIII(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k))
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define INF 2000000000
#define PI 3.1415926535897932384626
const ll MOD=1e9+7;
int main(){
        ll a,b,k;
        scanf("%lld%lld%lld",&a,&b,&k);
        if(a>=k) printf("%lld %lld\n",a-k,b);
        else{
                k-=a;
                printf("0 %lld\n",b-k>0?b-k:0);
        }
}

Measured memory_bytes: 256
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define md 998244353
#define trace(...)
#define ll long long int
#define ld long double
#define fi first
#define se second
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define mem(a) memset(a, 0, sizeof(a))
#define vpi std::vector<pair<int,int>>
#define pii pair<int,int>
#define pb push_back
#define sall(v) sort(v.begin(),v.end())
#define all(v) (v.begin(),v.end())
#define minf -10000000
#define vi vector<int>
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}
ll power(ll x, ll y,ll p) { 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or equal to p 
    while (y > 0) {  
        if (y & 1) // If y is odd, multiply x with result
            res = (res*x) % p;  
        y = y>>1; // y = y/2 // y must be even now
        x = (x*x) % p;   
    } 
    return res; 
}
ll power(ll x, ll y) { 
    ll res = 1;      // Initialize result 
    while (y > 0) {    
        if (y & 1)// If y is odd, multiply x with result 
            res = (res*x) ;  
        y = y>>1; // y = y/2 // y must be even now 
        x = (x*x);   
    } 
    return res; 
}
 
ll max3(ll a,ll b,ll c){
    return max(a,max(b,c));
}
ll min3(ll a,ll b,ll c){
    return min(a,min(b,c));
}
bool isPrime(ll n) { // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}

void solve() {
    deque<char> dq;
    string s;cin>>s;
    for(auto x:s)
        dq.push_back(x);
    int q;cin>>q;
    int f1,f2;char ch;
    int cnt=0;
    while(q--){
        cin>>f1;
        if(f1==1)cnt++;
        else{
            cin>>f2>>ch;
            if(f2==1){
                if(cnt%2==0)dq.push_front(ch);
                else dq.push_back(ch);
            }
            else{
                if(cnt%2==0)dq.push_back(ch);
                else dq.push_front(ch);
            }
        }
    }
    string res="";
    for(char it:dq)
        res+=it;
    if(cnt%2==0)
        cout<<res<<endl;
    else{
        int p=res.length();
        frr(i,p-1,0)cout<<res[i];
        cout<<endl;
    }
    return ;
}

int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout<<fixed<<setprecision(8);
    int t;
    // cin>>t;
    t=1;
    while(t--){
        solve();
    }
    return 0;
}

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

int main(){
	int x1, y1, x2, y2, vx, vy;

	cin >> x1 >> y1 >> x2 >> y2;

	vx = x2 - x1;
	vy = y2 - y1;

	cout << x2 - vy << " " << y2 + vx << " " << x1 - vy << " " << y1 + vx << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> A(N);
	vector<int> B(N);
	vector<int> C(N);
	int res = 0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> B[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> C[i];
	}
	vector<int> X(N, 1);
	vector<int> X2(N, 1);
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());
	int a = 0;
	for (int i = N - 2; i >= 0; i--) {
		X[i] += X[i + 1];
	}
	for (int i = 0; i < N; i++) {
		while (a < N && B[i] >= C[a]) {
			a++;
		}
		if (a == N) {
			X2[i] = 0;
		}
		else {
			X2[i] = X[a];
		}
	}
	swap(X2, X);
	a = 0;
	for (int i = N - 2; i >= 0; i--) {
		X[i] += X[i + 1];
	}
	for (int i = 0; i < N; i++) {
		while (a < N && A[i] >= B[a]) {
			a++;
		}
		if (a == N) {
			X2[i] = 0;
		}
		else {
			X2[i] = X[a];
		}
	}
	swap(X2, X);
	for (int i = 0; i < N; i++) {
		res += X[i];
	}
	cout << res << endl;
}

Measured memory_bytes: 4224
import java.util.Scanner;

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

    char[] O = scanner.next().toCharArray();
    char[] E = scanner.next().toCharArray();
    int i = 0;
    int j = 0;
    while (i < O.length || j < E.length) {
      if (i < O.length) System.out.print(O[i++]);
      if (j < E.length) System.out.print(E[j++]);
    }
    System.out.println();
  }
}


Measured memory_bytes: 23636
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)
 
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

int main(){
    string s;
	cin >> s;
	int cnt1 = 0, cnt2 = 0;
	REP(i, s.size()){
		if(i % 2 == 0){
			if(s[i] == '0') cnt1++;
		}
		else{
			if(s[i] == '1')	cnt1++;
		}
	}
	REP(i, s.size()){
		if(i % 2 == 0){
			if(s[i] == '1') cnt2++;
		}
		else{
			if(s[i] == '0')	cnt2++;
		}
	}

	cout << min(cnt1, cnt2) << endl;
}


Measured memory_bytes: 512
from itertools import accumulate
import numpy as np
N,K=list(map(int,input().split()))
point=[]
x_set=set()
y_set=set()

for i in range(N):
    x,y=list(map(int,input().split()))
    point.append((x,y))
    x_set.add(x)
    y_set.add(y)
x_arr=sorted(list(x_set))
y_arr=sorted(list(y_set))

x_dic={}
y_dic={}
for i,x in enumerate(x_arr):
    x_dic[x]=i
for i,y in enumerate(y_arr):
    y_dic[y]=i

square=[[0 for _ in range(len(x_arr)+1)] for _ in range(len(y_arr)+1)]
for p in point:
    j=x_dic[p[0]]
    i=y_dic[p[1]]
    square[i+1][j+1]+=1
square=np.array(square)

for i,line in enumerate(square):
    square[i]=list(accumulate(line))
for i,row in enumerate(square.T):
    square[:,i]=list(accumulate(row))

h=1
ans=float('inf')
W=len(square[0])
H=len(square)
for i in range(1,H):
    for j in range(i,H):
        h=1
        for k in range(1,W): 
            num=square[j][k]-square[i-1][k]-square[j][h-1]+square[i-1][h-1]
            while num>=K:
                S=max(y_arr[j-1]-y_arr[i-1],1)*max(x_arr[k-1]-x_arr[h-1],1)
                ans=min(ans,S)
                h+=1
                num=square[j][k]-square[i-1][k]-square[j][h-1]+square[i-1][h-1]
print(int(ans))

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

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

    int64_t n;
    std::cin >> n;
    std::vector<int64_t> A, B;
    for(int i=0; i<n; i++){
        int a, b;
        std::cin >> a >> b;
        A.push_back(a);
        B.push_back(b);
    }

    std::sort(A.begin(), A.end());
    std::sort(B.begin(), B.end());

    if(n%2){
        std::cout << B.at(n/2) - A.at(n/2) + 1;
    }else{
        int a = A.at(n/2-1)+A.at(n/2);
        int b = B.at(n/2-1)+B.at(n/2);
        std::cout << b - a + 1;
    }

    return 0;
}


Measured memory_bytes: 6680
#include <stdio.h>
#include <stdlib.h>
#define FOR(i,a,n) for(i=(a);i<(n);i++)
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define INF 1000000000000000LL
#define ll long long
#define MAX_V 100000
#define MAX_E 200000
typedef struct LIST{
	int to;
	struct LIST *next;
}Edge;
Edge *g[MAX_V];
Edge edge[MAX_E];
int e_size=0;
void add_edge(int s,int t){
	edge[e_size].next=g[s]; g[s]=&edge[e_size++];
	g[s]->to=t;
	return;
}
int color[MAX_V];
int dfs(int v,int c){
	Edge *e;
	color[v]=c;
	for(e=g[v];e!=NULL;e=e->next){
		if(color[e->to]==-c) continue;
		if(color[e->to]==color[v]||!dfs(e->to,-c)) return 0;
	}
	return 1;
}
int main(void)
{
	int n,m,a,b,cnt=0,flag,i;
	scanf("%d%d",&n,&m);
	FOR(i,0,m){
		scanf("%d%d",&a,&b);
		add_edge(--a,--b);
		add_edge(b,a);
	}
	flag=dfs(0,1);
	FOR(i,0,n) cnt+=(color[i]==1);
	if(!flag) printf("%lld\n",(ll)n*(n-1)/2-m);
	else printf("%lld\n",(ll)cnt*(n-cnt)-m);
	return 0;
}
    

Measured memory_bytes: 4736
//   __________________
//  | ________________ |
//  ||          ____  ||
//  ||   /\    |      ||
//  ||  /__\   |      ||
//  || /    \  |____  ||
//  ||________________||
//  |__________________|
//  \\#################\\
//   \\#################\\
//    \        ____       \
//     \_______\___\_______\
// An AC a day keeps the doctor away.

#pragma GCC optimize("Ofast")
#pragma loop_opt(on)
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define debug(x) 0//(cerr<<#x<<" = "<<(x)<<'\n')
#define all(v) begin(v),end(v)
#define siz(v) (ll(v.size()))
#define get_pos(v,x) (lower_bound(all(v),x)-begin(v))
#define pb emplace_back
#define ff first
#define ss second
#define mid (l+(r-l>>1))
#define rep(i,n) for(int i = 0; i < (n); i++)
#define REP(i,n) for(int i = 1; i <= (n); i++)

using namespace std;
using namespace __gnu_pbds;
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;
typedef pair<ll,ll> pll;
template <typename T> using rkt = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
constexpr ld PI = acos(-1), eps = 1e-8;
constexpr ll N = 502525, INF = 1e18, MOD = 998244353, K = 2;
constexpr inline ll cdiv(ll x, ll m) { return (x+m-1)/m; } // ceiling divide, x/m for flooring divide
template <typename T> void M(T &x, ll m = MOD){x%=m; if(x<0) x+=m;}

ll n,v[N],k;
signed main(){
    ios_base::sync_with_stdio(0), cin.tie(0);
  	cin >> n >> k;
  	cout << cdiv(n,k*2+1) << '\n';
}


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

double calcAverage(vector<double> S)
{
    double Sum = 0;
    for(int i = 0; i < S.size(); ++i){
        Sum += S[i];
    }
    return Sum / S.size();
}
double calcStandardDeviation(vector<double> S)
{
    double m = calcAverage(S);
    
    double aa = 0;
    for(int i = 0; i < S.size(); ++i){
        aa += pow(S[i] - m, 2)/S.size();
    }
    return sqrt(aa);
}

int main()
{
    
    while(true){
        int n;
        cin >> n;
        if(n == 0){
            break;
        }
        vector<double> S(n);
        for(int i = 0; i < n; ++i){
            cin >> S[i];
        }
        cout << fixed << setprecision(4);
        cout << calcStandardDeviation(S) << endl;
    }
    return 0;
}

Measured memory_bytes: 3260
// vim: shiftwidth=2 expandtab foldmethod=marker

// include {{{
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <utility>
#include <cstdlib>
#include <random>
#include <chrono>
// }}}

// debug(...) {{{
#ifdef LOCAL_DEBUG
#include "./debug.h"
#else
#define debug(...)
#define debugn(...)
#define debug_reset()
#endif

#include <cstdio>

template<class T>
std::string bin(int bits, const T& x) {
  char buf[bits + 1];
  buf[bits] = '\0';
  for(int i = 0; i < bits; i++) {
    if((x >> i) & 1) {
      buf[bits - i - 1] = '1';
    } else {
      buf[bits - i - 1] = '0';
    }
  }
  return std::string(buf);
}
std::string bin(int x) {
  if(x < 0) return bin(32, x);
  for(int i = 4; i < 31; i++) {
    int y = 1 << i;
    if(x < y) return bin(i, x);
  }
  return bin(32, x);
}
// }}}

// misc {{{
using namespace std;
template<class T, class U>

using umap = unordered_map<T, U>;
template<class T>
using uset = unordered_set<T>;

typedef long long ll;

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

template<class T>
void sort(T& arr) {
  std::sort(arr.begin(), arr.end());
}
template<class T, class By>
void sort_by(T& arr, By by) {
  std::sort(arr.begin(), arr.end(), [by](auto l, auto r){return  by(l) < by(r); });
}

template<class T>
void reverse(T& arr) {
  std::reverse(arr.begin(), arr.end());
}

class Random {
  public:
  std::uniform_int_distribution<> uniform_int;
  std::mt19937 rnd;
  std::bernoulli_distribution bern_dist;
  int uniform(int l, int r) {
    return uniform_int(rnd, std::uniform_int_distribution<>::param_type(l, r));
  }
  int next(int N) {
    return uniform(0, N - 1);
  }
  int bern(double p) {
    return bern_dist(rnd, std::bernoulli_distribution::param_type(p));
  }
};
// }}}

// main {{{
void solve();
int main() {
  solve();
}
// }}}

void solve() {
  string s;
  cin >> s;
  bool ans = true;
  rep(i, s.size()) {
    char c = s[i];
    if((i+1) % 2 == 1 && (c != 'R' && c != 'U' && c != 'D')) ans = false;
    if((i+1) % 2 == 0 && (c != 'L' && c != 'U' && c != 'D')) ans = false;
  }
  cout << (ans ? "Yes" : "No") << endl;
}


Measured memory_bytes: 888
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			double n = sc.nextLong();
			double m = sc.nextLong();
			List<Double> an = new ArrayList<>();
			for (long i = 0; i < n; i++) {
				an.add(sc.nextDouble());
			}
			double total = 0;
			for (double l : an) {
				total = total + l;
			}
			double border = total / (4 * m);
			long count = 0;
			for (double l : an) {
				if (!(l < border)) {
					count++;
				}
			}
			// 出力(文字列)
			System.out.println(count >= m ? "Yes" : "No");
		}
	}

	/**
	 * 最小公倍数
	 */
	static long lcm(long a, long b) {
		long temp;
		long c = a;
		c *= b;
		while ((temp = a % b) != 0) {
			a = b;
			b = temp;
		}
		return c / b;
	}

	/**
	 * 最大公約数
	 */
	static long gcd(long a, long b) {
		long temp;
		while ((temp = a % b) != 0) {
			a = b;
			b = temp;
		}
		return b;
	}
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
ll n,m,i,j,k,l,t,a,b,c,d,arr[200009];
map<ll,ll>mp;
vector<ll>v;
int main()
{
    scanf("%lld",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%lld",&arr[i]);
        l=i-arr[i];
        a+=mp[l];
        l=arr[i]+i;
        mp[l]++;
    }
    printf("%lld\n",a);
}


Measured memory_bytes: 28024
n = int(input())
s = []
t = []
for i in range(0,n):
  _s, _t = input().split()
  s.append(_s)
  t.append(_t)
x = input()

idx = s.index(x) +1
ans = 0
for i in range(idx, n):
  ans += int(t[i])
print(ans)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

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

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

// f(X): (X以下の整数のうち、CでもDでも割り切れないものの個数)
// = X - (CまたはDで割り切れるものの個数)
// = X - {(X/C + X/D - X/lcm(C, D))}
int main() {
  long long a, b, c, d;
  cin >> a >> b >> c >> d;

  const long long l = lcm(c, d);
  auto f = [&](long long x) { return x - (x / c + x / d - x / l); };
  long long ans = f(b) - f(a - 1);
  cout << ans << endl;
  return 0;
}


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

int main(){
  long long int N = 0;
  long long int B = 0;
  long long int c = 1;
  long long int i = 1;
  int num = 0;
  int ans = 10;
 
  cin >> N;
  
  for (c=1;c*c<=N;c++){
    num = 0;
    i = 1;
    if(N%c==0){
      B = N / c;
      while(B >= i){
       num = num + 1;
       i = i * 10;
      }
       if (ans > num ){
         ans = num;
       }
    }
    else{
      continue;
    }
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
using namespace std;
int main()
{
    int ai[105];
    int e=0,w=0,a,b,x;
    scanf("%d %d %d",&a,&b,&x);
    for (int i=0;i<b;i++)
    {
        int q;
        scanf("%d",&q);
        ai[q]=1;
        if(q<=x)
            e++;
        else if(q>x)
            w++;
    }
    if(e<=w)
        printf("%d\n",e);
    else
        printf("%d\n",w);
    return 0;
}


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

const int SN = 1e6+10;

signed main(void){ 
  int N; cin >> N;
  set<int> se,S;
  for(int i = 1; i <= SN; i++){ 
    
    if( (N-1) % i == 0 ){ //iは(N-1)の約数
     
      se.insert(i);
      se.insert((N-1)/i);
    }
    
    if( N % i == 0 ){ 
      S.insert(i);
      S.insert(N/i);
    }
  }
  
  int cnt1 = 0; int cnt2 = 0;
  
  if(!se.empty()){  //割り切れないとき
    
    for(auto K : se ){ 
      if( K == 1  ){ continue;} 
      
      int m = (N-1)/K;
      
      if( N-(m-1)*K >= K ){ cnt1++;}
      
    }
  }
  
  //割り切れるとき
  
  for(auto K : S ) {
    
    if( K == 1 ){ continue;}
    
    int res = N;
    
    while( res % K == 0 ){ 
      
      res /= K;
      
      if( res < K ){ break;}
      
    }
   
    if( res < K ){ 
      if( res == 1 ){cnt2++; continue;}
    }
    
    if( ( res - 1 ) % K == 0 ){ 
      
      int m = (res-1)/K;
      
      if( res - ( m-1 ) * K > K ){  cnt2++;}
      
    }
  }
  
  cout << cnt1+cnt2  << endl;
  
  return 0;
}
      
    

Measured memory_bytes: 512
n, q = map(int, input().split())
S = input()
count = 0
arr = [0]
for i in range(1, n):
    if S[i - 1:i + 1] == 'AC':
        count += 1
    arr.append(count)
for i in range(q):
    l, r = map(int, input().split())
    print(arr[r - 1] - arr[l - 1])

Measured memory_bytes: 6180
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
const int N=100005;
struct ELE{int x,y;}e[N];
bool cmp(ELE a,ELE b) {return a.x<b.x;}
int dep[N],n;
int erfen(int val)
{
    int l=1,r=n+1,mid;
    while (r-l>1)
    {
        mid=(l+r)/2;
        if (e[mid].x>=val) r=mid; else l=mid;
    }
    return r;
}
int cal(int num)
{
    int i,ans=0,pos=erfen(num);
    vector<int> a;
    if (e[pos].x!=num) return 0;
    for (i=pos;e[i].x==num;i++)
    {
        dep[e[i].y]=cal(e[i].y);
        a.push_back(dep[e[i].y]);
    }
    int tot=a.size();
    sort(a.begin(),a.end());
    for (i=0;i<tot;i++) ans=max(ans,a[i]+tot-i);
    return ans;
}
int main(int x)
{
  //  freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
    scanf("%d",&n);
    for (int i=2;i<=n;i++) {scanf("%d",&e[i].x);e[i].y=i;}
    sort(e+2,e+n+1,cmp);e[1].x=0,e[n+1].x=n+1;
    printf("%d\n",cal(1));
    
    return 0;
}


Measured memory_bytes: 10752
import sys
n = int(input())
a = list(map(int, input().split( )))

#3つ置きに一致する
S = {}
for ai in a:
    if ai in S:
        S[ai]+=1
    else:
        S[ai] = 1
A = list(S.keys())
#print(S)
#print(A)
#print(list(S.keys()))
#print(S.values())
if len(S) ==3:
    if A[0]==A[1]^A[2] and S[A[0]]==S[A[1]] and S[A[1]] == S[A[2]]:
        print("Yes")
    else:
        print("No")##漏れ


elif len(S)==2:#一番の漏れ
    if A[0]==0 and S[A[1]] == 2*S[A[0]]:#S[A[0]]==0じゃない
        print("Yes")
    elif A[1]==0 and S[A[0]] == 2*S[A[1]]:
        print("Yes")
    else:
        print("No")


elif len(S)==1:
    if list(S.keys())==[0]:#1.dict_keys、dict_valuesはリストでない 2.keysのほう
        print("Yes")
    else:###
        print("No")
else:
    print("No")



Measured memory_bytes: 60784
N, K = map(int, input().split())
MOD = 1000000007

fact = [0] * (N+1)
finv = [0] * len(fact)
inv  = [0] * len(fact)

fact[0] = fact[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, len(fact)):
    fact[i] = fact[i-1] * i % MOD
#    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    inv[i] = - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD

nCr = lambda n, r: fact[n] * finv[n-r] * finv[r] % MOD
nHr = lambda n, r: nCr(n+r-1, r)

# ans = 0
# for i in range(min(N-1, K) + 1):
#     ans += nCr(N, i) * nHr(N-i, i)
# ans = sum(nCr(N, i) * nHr(N-i, i) for i in range(min(N-1, K) + 1))
ans = sum(nCr(N, i) * nCr(N-1, i) for i in range(min(N-1, K) + 1))
print(ans % MOD)

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

H, W, K = map(int, input().split())
state = [input().rstrip() for _ in range(H)]

ans = 0
for bit1 in range(1<<H):
    for bit2 in range(1<<W):
        c = 0
        for h in range(H):
            for w in range(W):
                if state[h][w] == "#" and not bit1&(1<<h) and not bit2&(1<<w):
                    c += 1
        if c == K:
            ans += 1
print(ans)

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

const int MOD = 1000000007;

ll  F(const ll &n, const ll &k, vector<vector<ll>> &DP) {
    if (1==k)
        return 1;
    if (n<k)
        return 0;
    if (DP.at(n).at(k)>=0)
        return DP.at(n).at(k);
    ll S=F(n-1, k-1, DP)*k;
    S %=MOD;
    S +=F(n-1, k, DP)*k;
    S %=MOD;
    DP.at(n).at(k)=S;
    return S;
}

int main() {
    ll n, k;
    cin >>n >>k;
    vector<vector<ll>> DP(n+1, vector<ll> (k+1, -1));
    cout <<F(n, k, DP) <<endl;
    return 0;
}


Measured memory_bytes: 10756
/*input
13 23
ABAAAABBBBAAB
7 1
10 6
1 11
2 10
2 8
2 11
11 12
8 3
7 12
11 2
13 13
11 9
4 1
9 7
9 6
8 13
8 6
4 10
8 7
4 3
2 1
8 12
6 9
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back

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

#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int raise(int a,int n,int m = MOD){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= raise(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}

int floor1(int n,int k){
    if(n%k == 0 || n >= 0)return n/k;
    return (n/k)-1;
}

int ceil1(int n,int k){
    return floor1(n+k-1,k);
}

const int N = 2e5+1;

int cona[N];
int conb[N];
int n,m;
vector<int> adj[N];
bool del[N];
string s;

void solve(){
    cin >> n >> m;
    cin >> s;
    s = "$"+s;
    RE(i,m){
      int a,b;
      cin >> a >> b;
      adj[a].pb(b);
      adj[b].pb(a);
      if(a == b){
        if(s[a] == 'A')cona[a]++;
        else conb[a]++;
      }
      else{
        if(s[a] == 'A')cona[b]++;
        else conb[b]++;
        if(s[b] == 'A')cona[a]++;
        else conb[a]++;
      }
    }
    queue<int> q;
    RE(i,n){
      //cout << cona[i] << " " << conb[i] << endl;
      if(cona[i]*conb[i])continue;
      q.push(i);
      del[i] = 1;
    }
    int delss = 0;
    while(!q.empty()){
      int u = q.front();
      //cout << u << endl;
      q.pop();
      delss++;
      for(int v:adj[u]){
        if(del[v])continue;
        if(s[u] == 'A')cona[v]--;
        else conb[v]--;
        //cout << v << " " << cona[v] << " " << conb[v] << endl;
        if(cona[v]*conb[v])continue;
        q.push(v);
        del[v] = 1;
      }
    }
    if(delss == n){
      cout << "No";
    }
    else{
      cout << "Yes";
    }
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
  return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> cities(N, 0);
  int a, b;
  
  for(int i = 0; i < M; i++) {
    cin >> a >> b;
    cities[a-1]++;
    cities[b-1]++;
  }
  
  for(int i = 0; i < N; i++) {
    cout << cities[i] << endl;
  }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
from math import degrees, radians, sin, cos

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bisearch_max(mn, mx, func):
    """ 条件を満たす最大値を見つける二分探索(小数用) """

    ok = mn
    ng = mx
    for _ in range(100):
        mid = (ok+ng) / 2
        if func(mid):
            # 上を探しに行く
            ok = mid
        else:
            # 下を探しに行く
            ng = mid
    return ok

# カップをdig1度傾けた時、溢れるかどうか
def calc1(dig1):
    # 傾けた反対側の角度
    dig2 = 90 - dig1
    if dig2 == 0:
        return False
    # カップの上の先端の低い方の高さ
    h = b * sin(radians(dig2))
    # 溢れるギリギリの水面の横の長さ
    c = b / cos(radians(dig2))
    # 溢れるギリギリの面積
    limit = h * c / 2
    return S <= limit

def calc2(dig1):
    # コップの底を持ち上げる高さ
    h = a * sin(radians(dig1))
    # 溢れるギリギリの水面の横の長さ
    c = a / cos(radians(dig1))
    # 溢れるギリギリの面積(全体 - 上の空間)
    limit = a * b - h * c / 2
    return S <= limit

a, b, x = MAP()

# 体積を面積にしておく
S = x / a
# 量が全体の半分以上か以下で場合分け
if S <= a * b / 2:
    calc = calc1
else:
    calc = calc2
dig = bisearch_max(0, 90, calc)
print(dig)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define MOD 1000000007
using namespace std;

int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);cout.tie(NULL);
	int n,k;
	cin>>n>>k;
	vector<int> h(n);
	vector<int> dp(n,INT_MAX);
	for (int i = 0; i < n; ++i)
	{
		cin>>h[i];
	}
	dp[0]=0;
	for(int i=1;i<n;++i){
		for(int j=1;j<=k && i>=j;++j){
			dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
	cout<<dp[n-1];
	// cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>

int main(){
  int cost[100000][3],N;
  long long result[100000][3];

  std::cin >> N;
  for(int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      std::cin >> cost[i][j];
    }
  }
  for(int i=0;i<3;i++)
    result[0][i]=cost[0][i];

  for(int i=1;i<N;i++){
    for(int j=0;j<3;j++){
      result[i][0]=std::max(result[i-1][1],result[i-1][2])+cost[i][0];
      result[i][1]=std::max(result[i-1][0],result[i-1][2])+cost[i][1];
      result[i][2]=std::max(result[i-1][0],result[i-1][1])+cost[i][2];
    }
  }
  std::cout << std::max(std::max(result[N-1][0],result[N-1][1]),result[N-1][2]);
  return 0;
}


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

public class Main {
	static boolean p[];
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n,i,count;
		while(sc.hasNext()){
			count=0;
			n=sc.nextInt();
			p=new boolean[n+1];
			Arrays.fill(p, true);
			for(i=0;i<=n;i++){
				p[i]=prime(i);
			}
			for(i=0;i<=n;i++){
				if(p[i]) count++;
			}
			System.out.println(count);
		}
	}
	static boolean prime(int n){
		int i;
		if(n==2) return true;
		if(n<=1 || n%2==0) return false;

		for(i=3;i*i<=n;i+=2){
			if(n%i==0){
				return false;
			}
		}
		return true;
	}
}

Measured memory_bytes: 16000
package main

import "fmt"

func main() {
	// fmt.Printf("Hello world\n")
	var N int
	fmt.Scan(&N)
	Bz := make([]int, N-1)
	for i := 0; i < N-1; i++ {
		fmt.Scan(&Bz[i])
	}

	// var sum int
	sum := Bz[0]

	// fmt.Printf(sum

	// sum = Bz[0]
	// fmt.Println("sum ", sum)
	// fmt.Println(sum)
	// fmt.Println("sum2 ", sum)
	for i := 0; i < N-2; i++ {
		// fmt.Println(Bz[i])
		if Bz[i] > Bz[i+1] {
			Bz[i] = Bz[i+1]
		}
		sum += Bz[i]
	}
	sum += Bz[N-2]

	fmt.Println(sum)
}


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int h = sc.nextInt(), w = sc.nextInt();
		int[][] c = new int[10][10];
		for (int i = 0; i < 10; i++)
			for (int j = 0; j < 10; j++)
				c[i][j] = sc.nextInt();

		int[] d = new int[10];
		for (int i = 0; i < 10; i++)
			d[i] = d(c, i)[1];

		int count = 0;
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				int a = sc.nextInt();
				if (a != 1 && a != -1)
					count += d[a];
			}
		}
		System.out.println(count);
	}

	static int[] d(int[][] g, int s) {
		final int M = Integer.MAX_VALUE;
		int[] d = new int[10];
		Arrays.fill(d, M);
		d[s] = 0;

		boolean[] visited = new boolean[10];
		while (true) {
			int u = -1;
			int min = M;

			for (int i = 0; i < 10; i++) {
				if (!visited[i] && d[i] < min) {
					u = i;
					min = d[i];
				}
			}
			if (min == M) break;
			visited[u] = true;
			for (int i = 0; i < 10; i++)
				d[i] = Math.min(d[i], d[u] + g[u][i]);
		}
		return d;
	}
}


Measured memory_bytes: 45144
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <numeric>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define ALL(x) (x).begin(),(x).end()
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

ll mpow(ll a, ll b){
	if(b==0){
		return 1;
	}else if(b%2==0){
		ll memo = mpow(a,b/2);
		return memo*memo%MOD;
	}else{
		return mpow(a,b-1) * a % MOD;
	}
}

int main(){
	ll N, K; cin >> N >> K;
	ll ans1, ans2;
	ans1 = N-K+1; ans2 = 1;

	reps(i,K){
		cout << ans1 * ans2 % MOD << endl;
		ans1 *= N-K+1-i;
		ans1 %= MOD;
		ans1 *= mpow(i+1, MOD-2);
		ans1 %= MOD;
		ans2 *= K-i;
		ans2 %= MOD;
		ans2 *= mpow(i, MOD-2);
		ans2 %= MOD;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cstring>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

const int ms = 64;

int l[ms], r[ms];

void read(int a[ms]) {
	long long x;
	std::cin >> x;
	for(int i = ms-1; i >= 0; x /= 2, i--) {
		a[i] = (int)(x % 2);
	}
}

const int MOD = 1e9 + 7;

int memo[ms][2][2][2][2][2];

int dp(int on, int L1, int R1, int L2, int R2, int got) {
	if(on == ms) return 1;
	int &ans = memo[on][L1][R1][L2][R2][got];
	if(ans != -1) { return ans; }
	ans = 0;
	for(int i = 0; i < 2; i++) {
		for(int j = 0; j < 2; j++) {
			bool can = i >= j;
			if(got == 0) {
				can = can && i == j;
			}
			if(i == 0) can = can && (!L1 || l[on] == 0);
			else can = can && (!R1 || r[on] == 1);
			if(j == 0) can = can && (!L2 || l[on] == 0);
			else can = can && (!R2 || r[on] == 1);
			if(can) ans = (ans + dp(on+1, L1 && l[on] == i, R1 && r[on] == i, L2 && l[on] == j, R2 && r[on] == j, got || i)) % MOD;
		}
	}
	return ans;
}

int main() {
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	read(l);
	read(r);
	memset(memo, -1, sizeof memo);
	std::cout << dp(0, 1, 1, 1, 1, 0) << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b)  for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n)    FOR(i,0,n)
#define RER(i,n)    FOR(i,0,(n+1))
#define pb          push_back
#define mp(a,b)     make_pair((a),(b))
#define mset(m,v)   memset(m,v,sizeof(m))
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pair<ll, ll> > vpll;
typedef vector<string> vs;
typedef long double ld;
const double EPS    = 1e-10;
const int INF       = 1e+9;
const double PI     = acos(-1);


auto main() -> int
{
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;

    cout << (char)toupper(s1[0]) << (char)toupper(s2[0]) << (char)toupper(s3[0]) << endl;

    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
	int N, K;
	char S[10], s[10];

	scanf("%d", &N);
	scanf("%s", S);
	scanf("%d", &K);

	for (int i = 0; i < N; i++) {
		if (S[i] != S[K - 1]) {
			s[i] = '*';
		}
		else {
			s[i] = S[i];
		}
	}
	s[N] = '\0';
	printf("%s\n", s);

	return 0;
}

Measured memory_bytes: 128