akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
typedef long long ll;
const int INF = 1e9;
const ll LLINF = 1e18;


int main() {
    int N;
    string S;
    cin>>N>>S;
    
    bool f = false;
    int animals[100009];
    for(int i=0;i<8;i++){
        mem(animals,0);
        if(i&(1<<0)) animals[0]=1;
        if(i&(1<<1)) animals[1]=1;
        if(i&(1<<2)) animals[2]=1;
        
        for(int j=2; j<N-1; j++){
            if((animals[j]==0 && S[j]=='o') || (animals[j]==1 && S[j]=='x')){
                animals[j+1] = animals[j-1];
            }else{
                animals[j+1] = 1 - animals[j-1];
            }
        }
        
        if((animals[0]==0 && S[0]=='o') || (animals[0]==1 && S[0]=='x')){
            if(animals[N-1]!=animals[1]) continue;
        }else{
            if(animals[N-1]==animals[1]) continue;
        }
        
        if((animals[1]==0 && S[1]=='o') || (animals[1]==1 && S[1]=='x')){
            if(animals[0]!=animals[2]) continue;
        }else{
            if(animals[0]==animals[2]) continue;
        }
        
        if((animals[N-1]==0 && S[N-1]=='o') || (animals[N-1]==1 && S[N-1]=='x')){
            if(animals[N-2]!=animals[0]) continue;
        }else{
            if(animals[N-2]==animals[0]) continue;
        }
        f = true;
        break;
    }
    
    if(f){
        rep(i,N){
            if(animals[i]==0) cout<<'S';
            else cout<<'W';
        }
        cout<<endl;
    }else{
        cout1(-1);
    }
}

Measured memory_bytes: 896
module module1
sub main()
    dim number as string
    dim takoyaki as string
    number = console.readline()
    takoyaki = console.readline()
    dim a as string()
    a = split(takoyaki)
    dim b as string
    dim c as string
    c = number * (number - 1) / 2
    dim i as integer
    dim n as integer
    dim d as integer
    for i = 0 to number - 1
        for n = i + 1 to number - 1
            b = b + a(i) * a(n)
        next
        d = d + b
        b = 0
    next
    console.writeline(d)
End sub
end module


Measured memory_bytes: 13536
#include <iostream>
#include <vector>
#include <algorithm>
#define llint long long
#define mod 1000000007

using namespace std;

llint n;
llint a[500005], s[500005];
llint z[500005];
vector<llint> vec[500005];
llint sum[500005];
llint dp[500005];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int i = 1; i <= n; i++) s[i] = s[i-1] ^ a[i];
	
	bool flag = false;
	for(int i = 1; i <= n; i++){
		if(s[i] == 0) flag = true;
	}
	if(!flag){
		cout << 1 << endl;
		return 0;
	}
	
	vector<llint> comp;
	for(int i = 1; i <= n; i++) comp.push_back(s[i]);
	sort(comp.begin(), comp.end());
	comp.erase(unique(comp.begin(), comp.end()), comp.end());
	for(int i = 1; i <= n; i++) s[i] = lower_bound(comp.begin(), comp.end(), s[i]) - comp.begin();
	
	llint S = s[n];
	
	for(int i = 1; i <= n; i++) vec[s[i]].push_back(i);
	for(int i = 1; i <= n; i++){
		z[i] = z[i-1];
		if(s[i] == 0) z[i]++, z[i] %= mod;
	}
	
	//for(int i = 1; i <= n; i++) cout << s[i] << " "; cout << endl;
	//cout << S << endl;
	
	llint ans = 0;
	for(int i = 1; i < 500005; i++){
		llint N = vec[i].size();
				if(N == 0) continue;
		llint have = 0, sum = 0;
		dp[0] = 1, have++;
		for(int j = 1; j < N; j++){
			sum += have * (z[vec[i][j]] - z[vec[i][j-1]] + mod) % mod, sum %= mod;
			dp[j] = sum+1;
			have += dp[j], have %= mod;
		}
		if(S == 0){
			for(int j = 0; j < N; j++) ans += dp[j], ans %= mod;
		}
		else{
			if(i == S) ans += dp[N-1], ans %= mod;
		}
		//for(int j = 0; j < N; j++) cout << dp[j] << " "; cout << endl;
	}
	//cout << ans << endl;
	if(S == 0){
		llint tmp = 1;
		for(int i = 1; i < vec[0].size(); i++) tmp *= 2, tmp %= mod;
		ans += tmp, ans %= mod;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 44780
//
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define MODU 1000000007
// ll modpow (ll a, ll b, ll m){
//   if(b==0) return 1;
//   else{
//     ll z = modpow(a, b/2, m);
//     z = (z*z)%m;
//     if(b%2==0) return z;
//     else return (z*a)%m;
//   }
// }
// ll gcd(ll a, ll b){
//   if(b==0) return a;
//   else return gcd(b, a%b);
// }


int main(){
  int a(0), b(0);
  cin >> a >> b;
  if(a%2==0||b%2==0) cout << "Even";
  else cout << "Odd";
  return 0;
}
// notes
//


Measured memory_bytes: 256
def yonsin(X):
    if(int(X/4)):
        return yonsin(int(X/4))+str(X%4)
    return str(X%4)

n = int(input())
i = 0
yon = 0
cnt = 0
while (True):
	i += 1
	yon = yonsin(i)      
	if ('1' in yon and '2' in yon and '3' in yon and '0' not in yon):
		henkan = yon.replace('3','7').replace('2','5').replace('1','3')
		if (int(henkan) > n):
			break
		cnt += 1
print (cnt)

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

using namespace std;

int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    if (a <= 0 && b >= 0)
    {
        puts("Zero");
        return 0;
    }
    if (a < 0)
    {
        if ((-a - b) % 2 == 0)
        {
            puts("Negative");
            return 0;
        }
    }
    puts("Positive");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD (int)1e9+7
int a[25][25], dp[3000000];
signed main() {
	int n;
	cin >> n;
	rep(i, n) {
		rep(j, n) {
			cin >> a[i][j];
		}
	}
	dp[0] = 1;
	rep(i, n) {
		rep(j, (1 << n)) {
			int bitcount = 0;
			rep(k, n)if ((j >> k) & 1)bitcount++;
			if (bitcount != i)continue;
			rep(k, n) {
				if ((j >> k) & 1)continue;
				if (a[i][k]) {
					dp[j + (1 << k)] += dp[j];
					dp[j + (1 << k)] %= MOD;
				}
			}
		}
	}
	cout << dp[(1 << n) - 1] << endl;
	return 0;
}

Measured memory_bytes: 10496
#include<stdio.h>
#define MAX 10000

struct Node{
  int p, l, r;
};

struct Node Tree[MAX];
int n;
int depth[MAX], H[MAX];

int getDepth(int x){
  int count = 0;
  while(1){
    x = Tree[x].p;
    if ( x == -1 )
     break;
    count++;
  }
  return count;
}

int getSibling(int x){

  if ( Tree[x].p == -1 )
   return -1;
  if ( Tree[Tree[x].p].l != x && Tree[Tree[x].p].l != -1 )
   return Tree[Tree[x].p].l;
  if ( Tree[Tree[x].p].r != x && Tree[Tree[x].p].r != -1 ) 
  return Tree[Tree[x].p].r;

  return -1;
}

void print(int x){

  printf("node %d: ", x);
  printf("parent = %d, ", Tree[x].p);
  printf("sibling = %d, ", getSibling(x));
  int count = 0;
  if ( Tree[x].l != -1 ) count++;
  if ( Tree[x].r != -1 ) count++;
  printf("degree = %d, ", count);
  printf("depth = %d, ", depth[x]);
  printf("height = %d, ", H[x]);

  if ( Tree[x].p == -1 ){
    printf("root\n");
  } else if ( Tree[x].l == -1 && Tree[x].r == -1 ){
    printf("leaf\n");
  } else {
    printf("internal node\n");
  }
}

main(){
  int i, v, l, r;
  int c;
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    Tree[i].p = -1;
  }

  for ( i = 0; i < n; i++ ){
    scanf("%d %d %d", &v, &l, &r);
    Tree[v].l = l;
    Tree[v].r = r;
    if ( l != -1 ) 
        Tree[l].p = v;

    if ( r != -1 ) 
        Tree[r].p = v;
  }

  for ( i = 0; i < n; i++ ){
    depth[i] = getDepth(i);
    H[i] = 0;
  }

  for ( i = 0; i < n; i++ ){
    if ( Tree[i].l == -1 && Tree[i].r == -1 ) {
      H[i] = 0;
      int p = Tree[i].p;
         c = 1;
      while(1){
        if ( p == -1 ) break;
        if ( H[p] < c ) H[p] = c;
        c++;
        p = Tree[p].p;
      }
    }
  }

  for ( i = 0; i < n; i++ ) 
    print(i);
  return 0;
}


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

using namespace std;


int main(){
	int n;
	cin>>n;
	vector<int> divisors(n+1);
	for(int i=1;i<=n;i++){
		for(int j=i;j<=n;j+=i){
			divisors[j]++;
		}
	}
	long long ans=0;
	for(long long i=1;i<=n;i++){
		ans+=i*divisors[i];
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 42320
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
typedef long long ll;

// 解説を読んだ 賢い

int main(){
    int n, m;
    cin >> n >> m;
    int a, b;
    vector<int> v[n];
    for(int i = 0; i < m; i++){
        cin >> a >> b;
        a--, b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    vector<int> color(n, -1);
    stack<pair<int,int>> s;
    s.push({0,1});
    bool bigraph = true;
    while(!s.empty()){
        auto p = s.top(); s.pop();
        int i = p.first, j = p.second;
        if(color[i] == j)   continue;
        if(color[i] != -1){
            bigraph = false;
        }
        color[i] = j;
        for(int next : v[i]){
            if(color[next] == -1){
                s.push({next, 1-j});
            }else if(color[next] != 1-j){
                bigraph = false;
                break;
            }
        }
        if(!bigraph)    break;
    }
    if(bigraph){
        int cnt = 0;
        for(int i = 0; i < n; i++)  cnt += color[i] == 0;
        cout << (ll)(cnt)*(n-cnt)-m << endl;
    }else{
        cout << (ll)n*(n-1)/2-m << endl;
    }
    return 0;
}

Measured memory_bytes: 6272
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int a;
	cin >> a;
	long long int p=100;
	long double aa=1.01,nn,aaa;
	for(int i=1;i<=4000;i++){
		aaa=aa*p;
		long long int c=aaa;
		if(c>=a){
			cout<<i;return 0;
		}
		p=c;
		//cout<<p<<" ";
	}
	
	return 0;
}

Measured memory_bytes: 3640
row1 = list(map(int, input().split()))
row2 = list(map(int, input().split()))
row3 = list(map(int, input().split()))
K = (sum(row1) + sum(row2) + sum(row3)) / 3

if(row1[0]+row2[1]+row3[2] != K):
    print('No')
elif(row1[1]+row2[2]+row3[0] != K):
    print('No')
elif(row1[2]+row2[0]+row3[1] != K):
    print('No')
elif(row1[0]+row2[2]+row3[1] != K):
    print('No')
elif(row1[1]+row2[0]+row3[2] != K):
    print('No')
elif(row1[2]+row2[1]+row3[0] != K):
    print('No')
else:
    print('Yes')


Measured memory_bytes: 3064
/*
ID: jerrywcy
TASK:
LINK:
LANG: C++
*/
#include <bits/stdc++.h>

using namespace std;

const int inf=0x3f3f3f3f;

int n;
int dp[100010];

int p(int x,int y){
	int ret=1;
	while (y--)ret*=x;
	return ret;
}

int main()
{
	cin>>n;
	int i,j;
	for (i=1;i<=n;i++)dp[i]=inf;
	dp[0]=0;
	for (i=1;i<=5;i++){
		int d=p(9,i);
		if (d>n)break;
		for (j=d;j<=n;j++){
			dp[j]=min(dp[j],dp[j-d]+1);
		}
	}
	for (i=1;i<=6;i++){
		int d=p(6,i);
		if (d>n)break;
		for (j=d;j<=n;j++){
			dp[j]=min(dp[j],dp[j-d]+1);
		}
	}
	for (i=1;i<=n;i++){
		dp[i]=min(dp[i],dp[i-1]+1);
	}
	cout<<dp[n]<<endl;

	return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define fLoop for(lli i = 0; i < N; i++)
main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lli N;
    cin >> N;
    vector<lli> A, B;
    for(int i = 0; i < N; i++) {
    	int X, Y;
    	cin >> X >> Y;
    	A.push_back(X + Y);
    	B.push_back(X - Y);
	}
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	cout << max(abs(A[0] - A[N - 1]), abs(B[0] - B[N - 1])) << '\n';
}

Measured memory_bytes: 6688
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();	
		int [] L = new int [N+1];
		int [] R = new int [N+2];
		
		String color = sc.next(); 
		
		int left = 0;
		int right = 0;
		for (int i=0;i<N;i++) {
			if (color.charAt(i) == '#')
				left+=1;
			L[i+1]=left;
			
			if (color.charAt(N-i-1) == '.')
				right+=1;
			R[N-i]=right;
		}
		if (N!=1)
			L[N]=L[N-1];
			
		if (N!=1)
			R[0]=R[1];
		
		
		int tile = 100000;
		for (int i=1;i<N+1;i++) {
			tile = Math.min(L[i-1]+R[i+1], tile);
		}
		System.out.print(tile);
	}
}


Measured memory_bytes: 30628
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    # divisors.sort()
    return divisors

N = int(input())
lst = make_divisors(N)
lst.sort()
for i in range(N):
    if lst[i] * lst[i+1] >= N:
        break
if lst[i] ** 2 == N:
    print(lst[i] * 2 - 2)
else:
    print(lst[i+1]-1+lst[i]-1)

Measured memory_bytes: 3268
n,m = map(int,input().split())
lis = [list(input().split()) for _ in range(m)]

dp = [[0 for _ in range(2)] for _ in range(n)] # AC_flg, WA数

for i in range(m):
    if dp[int(lis[i][0])-1][0]==1:
        continue
    else:
        if lis[i][1]=='WA':
            dp[int(lis[i][0])-1][1] += 1
        if lis[i][1]=='AC':
            dp[int(lis[i][0])-1][0] = 1

ac = 0
wa = 0

for i in range(n):
    if dp[i][0]==1:
        ac += 1
        wa += dp[i][1]

print(ac,wa)

Measured memory_bytes: 40424
#include <bits/stdc++.h>
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define repi(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define SIZE_OF_ARRAY(array)    (sizeof(array)/sizeof(array[0]))
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;

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

  int s,w;
  cin >> s >> w;
  if(s<=w){
    cout << "unsafe" << endl;
  }else {
    cout << "safe" << endl;
  }
  
  return 0;
  }


Measured memory_bytes: 3648
#include<stdio.h>
#include<string.h>
int main()
{
    char a[100005];
    int i,l,cnt=0;
    scanf("%s",a);
    l=strlen(a);
    for(i=0;i<l-1;i++)
    {
        if(a[i]=='1'&&a[i+1]!='0')
        {
            a[i+1]='0';
            cnt++;
        }
        else   if(a[i]=='0'&&a[i+1]!='1')
        {
            a[i+1]='1';
            cnt++;
        }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,sta,end) for(ll i=sta;i<end;i++)
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define vvl vector<vector<ll>>
#define vl  vector<ll>
#define acc_io cin.tie(0);ios::sync_with_stdio(false)
//name[i]   -> vl  name(i)
//name[i][j]-> vvl name(i,vl(j))
//or-> ||
#include <math.h>

signed main(){
	acc_io;
	ll x;
	cin>>x;
	ll y=1,tmp=100;
	while(1){
//		tmp*=1.01;
		tmp+=tmp/100;
		if(x<=tmp) break;
		y++;
	}
	cout<<y<<endl;
	return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
using ll =long long int;
constexpr ll mod = 1e6;
vector<int>arr[mod];
int res[mod];
int main()
{
	int n, m;
	cin >> n >> m;
	vector<bool>vis(n + 1, false);
	for (int i = 1; i <= m; ++i) {
		int a, b; cin >> a >> b;
		arr[a].push_back(b);
		arr[b].push_back(a);
	}
	queue<int>q;
	q.push(1);
	vis[1] = true;
	while (!q.empty()) {
		int x = q.front();
		q.pop();
		for (auto ele : arr[x]) {
			if (!vis[ele]) {
				vis[ele] = true;
				res[ele] = x;
				q.push(ele);
			}
		}
	}
	cout << "Yes\n";
	for (int i = 2; i <= n; ++i) {
		cout << res[i] << "\n";
	}
	return 0;
}

Measured memory_bytes: 31580
#include<stdio.h>
int main()
{
	int a,b,i;
	char c[1000];
	scanf("%d %d",&a,&b);
	for(i=1;i<=b+2;i++)
	printf("#");
	printf("\n");
		for(i=1;i<=a;i++)
	{
	scanf("%s",c);

	printf("\n#%s#\n",c);
}
	for(i=1;i<=b+2;i++)
	printf("#");
	printf("\n");
	return 0;
	
} 

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define nmod         -1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define xxx         exit(0);
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x) 
{
    return (ll)(log(x)/log(base));
}
ll n,m,dp[3005][3005]; string s,t,ans;
ll cc(ll i, ll j)
{
	if(i<0 || j<0) return 0;
	if(dp[i][j]!=-1) return dp[i][j];
	if(s[i]==t[j])
	{
		dp[i][j] = 1 + cc(i-1,j-1);
	}
	else
	{
		dp[i][j] = max(cc(i-1,j), max(cc(i,j-1),cc(i-1,j-1)));
	}
	return dp[i][j];
}
ll mx(ll a, ll b, ll c)
{
	return max(a,max(b,c));
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS; 
    while(TESTS--)
    {
    	ll i,l,j,x1,y1,x,y,z,q,h;
    	cin>>s>>t;
    	n=s.size(); m=t.size(); char d;
		repi(i,0,n)
		{
			repi(j,0,m)
			{
				dp[i][j]=-1;
			}
		}
		cc(n-1,m-1);
		i=n-1; j=m-1;
		while(i>=0 && j>=0)
		{
			if(i==0 && j==0)
			{
				if(dp[i][j]==1) ans = s[i] +ans;
				break;
			}
			x=dp[i][j]; d=s[i];
			if(i-1>=0 && j-1>=0)
			{
				l=dp[i-1][j]; q=dp[i][j-1]; h=dp[i-1][j-1];
				if(h==mx(l,q,h)){
					i--; j--;
				}
				else if(l==mx(l,q,h)) i--;
				else j--;
			}
			else if(i-1>=0) i--;
			else j--;
			y=dp[i][j];
			if(x>y) ans = d + ans;
		}
		cout<<ans;
	}
	return 0;
}


Measured memory_bytes: 74484
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
 
using namespace std;
typedef long long ll;

int main()
{
	int N,K;
	int D[10];
	
	scanf("%d %d", &N, &K);
	for(int i = 0; i < K; i++){
		scanf("%d", &D[i]);
	}
	
	int ans;
	for(int i = N; i < 99999; i++){
		int pay = i;
		bool isAns = true;
		while(pay > 0){
			for(int j = 0; j < K; j++){
				if(pay % 10 == D[j]){
					isAns = false;
					continue;
				}
			}
			if(!isAns){
				break;;
			}
			pay /= 10;
		}
		if(isAns){
			ans = i;
			break;
		}
	}
	
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define mod 1000000007 
using namespace  std ;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v)
{
    ll a ;
    for(ll i=0 ; i<v.size() ; i=i+1)
    {
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
long long power(long long k , long long n , long long m)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}
long long fact(long long n , long long m = mod)
{
    long long a = 1 ;
    if(n==0 || n==1)
    {
        return(1) ;
    }
    while(n>0)
    {
        a = (a%m * n%m)%m ;
        n-- ;
    }
    return(a) ;
}
ll n,m,k;
vector<double>v;
double dp[3003][3003];
double solve(ll i ,ll j)
{
    if(i>=n && j>n/2)
    {
        return(1);
    }
    else if(i>=n)
    {
        return(0);
    }
    if(dp[i][j]!=-1)
    {
        return(dp[i][j]);
    }
    double ans = solve(i+1,j)*(1-v[i]) + solve(i+1,j+1)*(v[i]);
    dp[i][j] = ans;
    return(ans);
}
int main()
{
    ios_base::sync_with_stdio(false);//this and next two lines for cin cout TLE handling
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(12);
    ll a,b,c,d,e,x,i,j,t,y,w;
    double p,q,r,u,s ;
    string str = "",str1 = "",str2="" ;
    /*char ch,chr ;
    ll a1=0,a2=0,b1=0,b2=0 ;*/
    cin>>n;
    for(i=0 ; i<n ; i=i+1)
    {
        cin>>p;
        v.pb(p);
    }
    for(i=0 ; i<n+3 ; i=i+1)
    {
        for(j=0 ; j<n+3 ; j=j+1)
        {
            dp[i][j] = -1 ;
        }
    }
    p = solve(0,0);
    cout<<p;
}

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

int main(void) {
    string s;
    int i = 0;
    cin >> s;
    
    vector<int> ab(26,0);
    for(i=0;i<s.size();i++) {
        ab[s[i] - 'a'] = 1;
    }

    for(i=0;i<26;i++) {
        if(!ab[i]) {
            break;
        }
    }

    if(i < 26) {
        printf("%c\n",'a' + i);
    } else {
        cout << "None\n";
    }
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
  
 string st1,st2;
  cin>>st1>>st2;
  int n=st1.size();
  int m=st2.size();
  
  char arr1[n+1],arr2[m+1];
  for(int i=1;i<=n;i++)
    arr1[i]=st1[i-1];
  for(int j=1;j<=m;j++)
    arr2[j]=st2[j-1];
  
  int dp[n+1][m+1];
  
  for(int i=0;i<=n;i++)
    dp[i][0]=0;
  for(int j=0;j<=m;j++)
    dp[0][j]=0;
  
  
  for(int i=1;i<=n;i++)
  {
    for(int j=1;j<=m;j++)
    {
      if(arr1[i]==arr2[j])
        dp[i][j]=dp[i-1][j-1]+1;
      else
        dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    }
  }
  int i=n,j=m; string ans="";
  while(i>0 && j>0)
  {
    if(arr1[i]==arr2[j])
    {
      ans=arr1[i]+ans;
      i--;j--;
      
    }
    else
      if(dp[i][j-1]>dp[i-1][j])
        j--;
    else
      i--;
  }
  
 
    cout<<ans<<endl;
  
  return 0;
}

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

int main(){
    int N, D; cin >> N >> D;
    int res = 0;
    if( N %  (2 * D  + 1) == 0)res = N / (2 * D  + 1);
    else res = N / (2 * D  + 1) + 1;
    cout << res << endl;
}

Measured memory_bytes: 256
x = int(input())

notsolved = True
for a in range(-500, 500):
    if notsolved:
        for b in range(-500, 500):
            if a**5-b**5 < x:
                continue
            if a**5-b**5 == x:
                print(str(a)+" "+str(b))
                notsolved = False


Measured memory_bytes: 9180
import sys
input = sys.stdin.readline
mod = 10**9+7

n, k = map(int, input().split())
A = list(map(int, input().split()))
B = []
C = []
s = 0
t = 0
for a in A:
  if a < 0:
    B.append(-a)
    s += 1
  elif a > 0:
    C.append(a)
    t += 1
if s + t < k:
  print(0)
  exit()
if s + t == k:
  if k == n:
    ans = 1
    for a in A:
      ans *= a
      ans %= mod
    print(ans)
  else:
    if s%2:
      print(0)
    else:
      ans = 1
      for b in B:
        ans *= b
        ans %= mod
      for c in C:
        ans *= c
        ans %= mod
      print(ans)
  exit()
B.sort(reverse=True)
C.sort(reverse=True)
ans = 1
nb = 0
nc = 0
if t == 0:
  if k%2:
    if s == n:
      for b in B[-k:]:
        ans *= b
        ans %= mod
      ans *= -1
      ans %= mod
      print(ans)
    else:
      print(0)
  else:
    for b in B[:k]:
      ans *= b
      ans %= mod
    ans %= mod
    print(ans)
  exit()
for _ in range(k):
  if nb >= s:
    ans *= C[nc]
    ans %= mod
    nc += 1
  elif nc >= t:
    ans *= B[nb]
    ans %= mod
    nb += 1
  else:
    if B[nb] > C[nc]:
      ans *= B[nb]
      ans %= mod
      nb += 1
    else:
      ans *= C[nc]
      ans %= mod
      nc += 1
if nb%2:
  if nb == s:
    ans *= pow(B[-1], mod-2, mod)
    ans %= mod
    ans *= C[nc]
    ans %= mod
    print(ans)
  elif nc == t:
    ans *= B[nb]
    ans %= mod
    ans *= pow(C[-1], mod-2, mod)
    ans %= mod
    print(ans)
  else:
    if nc == 0:
      ans *= pow(B[nb-1], mod-2, mod)
      ans %= mod
      ans *= C[0]
      ans %= mod
      print(ans)
    else:
      if C[nc-1]*C[nc] >= B[nb-1]*B[nb]:
        ans *= pow(B[nb-1], mod-2, mod)
        ans %= mod
        ans *= C[nc]
        ans %= mod
        print(ans)
      else:
        ans *= pow(C[nc-1], mod-2, mod)
        ans %= mod
        ans *= B[nb]
        ans %= mod
        print(ans)
else:
  print(ans)

Measured memory_bytes: 31592
using System;
    class Rectangle
    {
        static void Main()
        {
            String x = Console.ReadLine();
            String[] y = x.Split();
            int a = int .Parse( y[0] );
            int b = int .Parse( y[1] );
            int c = a * b;
            int d = 2*a + 2*b;
            Console .WriteLine( c + " " + d );
        }
    }

Measured memory_bytes: 9000
x,y=map(int,input().split())
x2=y//2-x
x1=x-x2
if(y==0 and x>0):
    print("No")
if(y%2!=0):
    print("No")
elif(x1==0 and x2==0):
    print("No")
elif(x1>=0 and x2>=0):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9192
def intinput(): return map(int,input().split())

x,y,z,k=intinput()
a = list(intinput())
b = list(intinput())
c = list(intinput())
a.sort(reverse=1)
b.sort(reverse=1)
c.sort(reverse=1)
abc=[]
for i in range(x):
    for j in range(y):
        if (i+1)*(j+1)>k:
            break
        for l in range(z):
            if (i+1)*(j+1)*(l+1)>k:
                break
            abc.append(a[i]+b[j]+c[l])
abc.sort(reverse=1)
for i in range(k):
    print(abc[i])

Measured memory_bytes: 8708
#include<stdio.h>
int main(void){
  char a[4];
  int i,b=0,c=0;
  scanf("%s",a);
  for(i=0;i<4;i++){
    if(a[i]=='a') b++;
    if(a[i]=='b') c=c+2;
    if(a[i]=='c') b=b+3;
  }
  if(b==4&&c==2) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 128
#include<bits//stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n;i++)
int main() {
    int h, w, k, fa,fj, ans, sum = (1 << 30);cin >> h >> w >> k;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    rep(bit, (1 << h - 1)) {
        fa = 0;vector<int> id(h);
        rep(i, h) {
            id[i] = fa;
            if (bit >> i & 1) fa++;
        }
        fa++;
        vector<vector<int>> S(fa, vector<int>(w, 0));
        rep(i, h) rep(j, w) S[id[i]][j] += (s[i][j] - '0');
        vector<int> now(fa);
        ans = fa - 1;
        auto add = [&](int j) {
            rep(i, fa) now[i] += S[i][j];
            rep(i, fa)if (now[i] > k)return  false;
            return true;
        };
        rep(j, w) {
            if (!add(j)) {
                ans++;now = vector<int>(fa);
                if (!add(j) ){
                    ans = (1 << 30);
                    break;
                }
            }
        }
        sum = min(sum, ans);
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
def my_match s,t
  
  sl = s.length
  
  sl.times do |i|
    # puts i
    return false if s[i] != ?? and s[i] != t[i]
  end
  return true
end

def solve sp,t
  
  s = sp
  
  sl = s.length
  tl = t.length
  
  no = "UNRESTORABLE"
  
  i = sl - 1
  j = tl - 1
  
  return no if sl < tl
  
  if sp.include?(t)
    
    k = sp.index(t)
    s[k, tl] = t
    return s.gsub(??, ?a)
  end
  
  k = sl - tl
  # puts k
  k.downto(0) do |kk|
    if my_match(sp[kk,tl],t)
      s[kk,tl] = t
      # puts s
      # puts 1
      return s.gsub(??, ?a)
    end
  end
  
  return no
end

sp = gets.chomp
t = gets.chomp


puts solve sp,t

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

int main() {
  
  int N, A, X;
  cin >> N >> A;
  
  X = N / 500;
  
  if (N - 500 * X <= A) {
	cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  int N, M; cin >> N >> M;
  vector<PII> ps(M);
  REP(i,M) cin >> ps[i].first >> ps[i].second;

  SORT(ps);
  for(int i=0;i+1<SZ(ps);++i){
	if(ps[i+1].first <= ps[i].second){
	  ps[i].second = max(ps[i].second, ps[i+1].second);
	  ps.erase(ps.begin() + i + 1);
	  --i;
	}
  }

  int ans = 0, l = 0;
  for(int i=0;i<SZ(ps);++i){
	//	cout << ps[i].first << ", " << ps[i].second << endl;
	
	ans += ps[i].second - l + 2 * (ps[i].second - ps[i].first);
	l = ps[i].second;
  }
  ans += N+1 - l;
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 1204
//by Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<s32>
#define p32 pair<int,int>
#define p64 pair<ll,ll>
#define fi first
#define se second
#define ln '\n'
#define debug(x) cout << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream& operator<<(ostream& out, const pair<T,U>& p){
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename ...Args>
void print_container(const ContainerType<ValueType, Args...>& c){
	cout << "{ ";
	for(const auto& v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

int main()
{
	FASTIO;
	int a;
	string s;
	cin >> a;
	cin >> s;
	if(a >= 3200)
		cout << s << ln;
	else
		cout << "red" << ln;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
#define max_heap priority_queue<int>
#define min_heap priority_queue<int,vector<int>,greater<int>>
using ll = long long;
#define int long long
#define endl "\n"
#define vi vector<int>
#define pb push_back
#define inp_arr(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define out_arr(a) for(ll i=0;i<a.size();i++)cout<<a[i]<<" ";
#define deb(n) cerr << #n << " = " << n << "\n";
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
ll mypower(ll x,ll n,ll c){
    if(n == 0)
        return 1;
    ll temp = mypower(x,n/2,c)%c;
    if(n%2)
        return (n<0)? (1/x)*temp*temp%c: ((x*temp)%c)*temp%c;
    else
        return temp*temp%c;
}
bool codejam = 0;

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	ll red,green,blue;
	cin>>red>>green>>blue;
	ll k;
	cin>>k;
	int steps = 0;
	while(green<=red){
		green*=2;
		steps++;
	}
	while(blue<=green){
		blue*=2;
		steps++;
	}
	if(steps<=k){
		cout<<"Yes"<<endl;
	}
	else
		cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

#define st first
#define nd second
#define int long long
const int N = 2e5+5, LOGN = 65;
int n, a[N], cnt = 0, u = 1, lg, in[N];
pair<int,int> par[LOGN][N];
long long k;
vector<int> v, cont[N];

signed main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        cont[a[i]].push_back(i);
    }
    for (int i = 1; i <= N; i++)
    {
        int m = cont[i].size();
        if (!m) continue;
        if (m == 1)
        {
            if (cont[i][0] == n)
                par[0][cont[i][0]] = {1,2};
            else
            par[0][cont[i][0]] = {cont[i][0]+1,1};
            continue;
        }
        for (int j = 0; j < m-1; j++)
        {
            if (cont[i][j+1] == n)
                par[0][cont[i][j]] = {1,1};
            else
            {
                par[0][cont[i][j]] = {cont[i][j+1]+1,0};
            }
        }
        par[0][cont[i][m-1]].st = cont[i][0]+1;
        par[0][cont[i][m-1]].nd = 1;
    }

    //for (int i = 1; i <= n; i++)
     //   cout << i << ' ' << par[0][i].st << ' ' << par[0][i].nd << endl;
    int lg = log2(n*k);
    for (int j = 1; j <= lg; j++)
    {
        for (int i = 1; i <= n; i++)
        {
            par[j][i].st = par[j-1][par[j-1][i].st].st;
            par[j][i].nd = par[j-1][i].nd + par[j-1][par[j-1][i].st].nd;
        }
    }

    for (int j = LOGN-1; j >= 0; j--)
    {
        if (!par[j][u].st || cnt+par[j][u].nd >= k) continue;
        //cout << j << ' ' << u << ' ' << par[j][u].st << endl;
        cnt += par[j][u].nd;
        u = par[j][u].st;
    }
    for (int i = u; i <= n; i++)
    {
        if (!in[a[i]])
        {
            v.push_back(a[i]);
            in[a[i]] = 1;
        }
        else
        {
            while(in[a[i]])
            {
                in[v.back()] = 0;
                v.pop_back();
            }
        }
    }
    for (int x: v)
        cout << x << ' ';

}


Measured memory_bytes: 199160
# -*- coding:utf-8 -*-
from decimal import *
import math
k,a,b = map(int, input().split())
if a >= k:
    print(1)
else:
    if a <= b:
        print(-1)
    else:
        print(2*math.ceil(Decimal(k-a)/Decimal(a-b))+1)

Measured memory_bytes: 5588
masterx,mastery= list(map(int,input().split(" ")))
ans = 10**15

for i in [1,-1]:
    for j in [1,-1]:
        temp = 0
        x = i * masterx
        y = j * mastery
        temp = temp + 1 if i == -1 else temp
        temp = temp + 1 if j == -1 else temp
        if y - x >= 0:
            temp +=  y - x
            ans = min(temp,ans)



print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(V) V.begin(),V.end()
#define MOD 998244353

vector<int> A[200010];
int ans[200010];

void dfs(int c, int p) {
	ans[c] = p;
	for (int i : A[c]) {
		if (ans[i] != 0)continue;
		dfs(i, c);
	}
}

int main() {
	int N, M, a, b;
	cin >> N >> M;
	for (int i = 0;i < M;i++) {
		cin >> a >> b;
		A[a].push_back(b);
		A[b].push_back(a);
	}
	queue<pair<int, int>> Q;
	Q.push({ -1,1 });
	while (!Q.empty()) {
		tie(a, b) = Q.front();
		Q.pop();
		if (ans[b] != 0)continue;
		ans[b] = a;
		for (int i : A[b]) {
			if (ans[i] != 0)continue;
			Q.push({ b,i });
		}
	}
	a = 0;
	for (int i = 2;i <= N;i++) {
		if (ans[i] == 0)a = 1;
	}
	if (a) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
		for (int i = 2;i <= N;i++) {
			cout << ans[i] << endl;
		}
	}
}

Measured memory_bytes: 13216
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

mod = 10**9+7

A,B,C = map(int,input().split())
extra = []

import time

now = time.time()

mod = A
while True:
    mod += A
    if mod % B == C:
        print("YES")
        break
    if time.time()-now > 1:
        print("NO")
        break



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

int n,i,a[100001],s[2][100001],maxv[2],maxv2[2],num[2],num2[2];

int main(){
	cin >> n;
	for(i=1;i<=n;i++){
		cin >> a[i];
		s[i&1][a[i]]++;
		if(maxv[i&1]<s[i&1][a[i]])
			if(num[i&1]==a[i])
				maxv[i&1]=s[i&1][a[i]];
			else{
				num2[i&1]=num[i&1];
				maxv2[i&1]=maxv[i&1];
				maxv[i&1]=s[i&1][a[i]];
				num[i&1]=a[i];
			}
		else if(maxv2[i&1]<s[i&1][a[i]] || (s[i&1][a[i]]==maxv[i&1] && num[i&1]!=a[i])){
			maxv2[i&1]=s[i&1][a[i]];
			num2[i&1]=a[i];
		}
	}
	if(num[0]!=num[1])
		cout << n-maxv[0]-maxv[1];
	else
		cout << n-max(maxv[0]+maxv2[1],maxv[1]+maxv2[0]);
	return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>
int main(){
	int a1,a2,a3,t;
	scanf("%d%d%d",&a1,&a2,&a3);
	if(a1>a2){
		t=a1;
		a1=a2;
		a2=t;
	}
	if(a1>a3){
		t=a1;
		a1=a3;
		a3=t;
	}
	if(a2>a3){
		t=a2;
		a2=a3;
		a3=t;
	}
	printf("%d\n",a3-a2+a2-a1);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define watch(x) cout<<"->"<<#x<<" : "<<x<<endl;
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c)) 
#define all(v) (v).begin(),(v).end()
typedef long long ll;
typedef unsigned long long llu;
const double PI = 2*acos(0.0);
bool sorted(vector<int> &p)
{
	for(int i=0;i<p.size()-1;i++)
		if(p[i]>p[i+1])
			return 0;
	return 1;
}
signed main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	vector<int> p(n);
	for(int i=0;i<n;i++)cin>>p[i];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			swap(p[i],p[j]);
			if(sorted(p))
			{
				return cout<<"YES",0;
			}
			swap(p[i],p[j]);
		}
	}
	return cout<<"NO",0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

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


    int n,ans = 0;
    cin>>n;
    vector<int>l(n);
    rep(i,n)cin>>l[i];

    rep(i,n){
        rep(j,i + 1,n){
            rep(k,j + 1,n){
                if(l[i] != l[j] && l[j] != l[k] && l[i] != l[k]){
                    if(l[i] + l[j] > l[k] && l[k] + l[j] > l[i] && l[i] + l[k] > l[j] )ans++;
                }
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll a, ll b) {
  ll smaller = min(a, b);
  ll bigger = max(a, b);
  ll surplus = bigger % smaller;
  if (surplus == 0) return smaller;
  surplus = gcd(smaller, surplus);
  return surplus;
}

//最小公倍数を求めるメソッド
ll lcm(ll a, ll b) {
  return a * b / gcd(a, b);
}

int main() {
  ll n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  bool ok = true;
  if(s[0] != t[0]) ok = false;
  if(n ==m){
    if(s != t)ok = false;
  }
  if(gcd(n,m) > 1){
    int s_num = n / gcd(n, m);
    int t_num = m / gcd(n, m);
    int i = 0;
    int j = 0;
    while (i < n && j < m){
      if(s[i] != t[j]){
        ok = false;
        break;
      }
      i += s_num;
      j += t_num;
    }
  }
  if(ok){
    cout << lcm(n, m) << endl;
  }else{
    cout << -1 << endl;
  }
}

Measured memory_bytes: 3756
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    if(n>=30){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 3620
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string S = Console.ReadLine();
		string T = Console.ReadLine();
		int ans = 0;
		for(var i=0;i<S.Length;i++){
			string s1 = S.Substring(i,1);
			string t1 = T.Substring(i,1);
			if(s1!=t1){
				ans++;
			}
		}
		Console.WriteLine(ans);
	}
}

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

typedef long long int lld;

/*
g++ -std=c++11 b-frog.cpp -o k
*/
int main() {
    int N, K;
    cin >> N >> K;
    int h[N];
    for(int i = 0; i < N; i++) {
        cin >> h[i];
    }
    
    int c[N];
    c[0] = 0;
    for(int i = 1; i < N; i++) {
        c[i] = -1;
        for(int j = i-1; j >= max(0, i-K); j--) {
            if(c[i] == -1)
                c[i] = abs(h[i] - h[j]) + c[j];
            else
                c[i] = min(c[i], abs(h[i] - h[j]) + c[j]);
        }
    }
    cout << c[N-1] << endl;

    return 0;
}



Measured memory_bytes: 1024
N, K = map(int, input().split())
LRs = [list(map(lambda x:int(x), input().split())) for _ in range(K)]

mod = 998244353
#%%
options = []

for LR in LRs:
    for i in range(LR[0], LR[1]+1):
        options.append(i)

options = sorted(options)

dp = [0 for _ in range(N+1)]
dp[1] = 1

rui = [0 for _ in range(N+1)]
rui[1] = 1

for i in range(2,N+1):
    for LR in LRs: # L <= R
        smaller, bigger = LR[0], LR[1]
        left = max(0, i-bigger-1)
        right = i - smaller
        add =  rui[right] - rui[left]
        dp[i] = (dp[i] + add) %mod
    rui[i] = rui[i-1] + dp[i]
    
print(dp[N]%mod)

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

typedef pair<double, double> pd;
typedef vector<pd> vpd;


#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> t chmax(t&a,u b){if(a<b)a=b; return a;};
template<class t, class u> t chmin(t&a,u b){if(a>b)a=b; return a;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

ll D;
vll c(26);
vvll s;
vll t;
vvll last;
vll ans_vec;

ll M;
vll d, q;

void calc(ll first){
  FOR(i,first,D){
    ans_vec[i+1] = ans_vec[i];
    ans_vec[i+1] += s[i][t[i]];

    last[i+1] = last[i];
    last[i+1][t[i]] = i+1;
    ll tmp = 0;
    REP(j,26){
      tmp += c[j]*(i+1-last[i+1][j]);
    }

    ans_vec[i+1] -= tmp;
  }
  return;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  IN(D);
  REP(i,26){
    IN(c[i]);
  }
  s.resize(D, vll(26));
  REP(i,D){
    REP(j,26){
      IN(s[i][j]);
    }
  }
  ans_vec.resize(D+1, 0);
  last.resize(D+1, vll(26, 0));
  t.resize(D);
  REP(i,D){
    IN(t[i]);
    t[i]--;
  }
  calc(0);

  IN(M);
  d.resize(M);
  q.resize(M);
  REP(i,M){
    IN(d[i], q[i]);
    d[i]--; q[i]--;
    t[d[i]] = q[i];

    calc(d[i]);

    OUT(ans_vec[D]);

  }

  return 0;
}

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

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

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

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

        int N;
        std::cin >> N;

        vector<int> diff(N);
        REP(i, N) {
            std::cin >> diff[i];
        }

        REP(i, N) {
            int c;
            std::cin >> c;
            diff[i] -= c;
        }

        int ans = 0;
        REP(i, N) {
            if(0 < diff[i]) {
                ans += diff[i];
            }
        }

        std::cout << ans << std::endl;
    }
    catch(const exception& e) {
        std::cout << e.what() << std::endl;
        exit(1);
    }
    return 0;
}


Measured memory_bytes: 256