akhauriyash/Code-Regression huggingface dataset:
n = int(raw_input())

red = []
blue = []

for a in range(n):
  q = map(int,raw_input().split(" "))
  red.append(q)

for a in range(n):
  q = map(int,raw_input().split(" "))
  blue.append(q)

red.sort()
blue.sort()
G = []
for a in range(n*2):
  G.append([])

used = [0]*(n*2)
match = [-1]*(n*2)

def add_edge(u,v):
  global G
  G[u].append(v)
  G[v].append(u)

def dfs(v):
  global G,match,used
  used[v] = 1
  for i in range( len(G[v]) ):
    u = G[v][i]
    w = match[u]
    if w < 0 or (used[w] != 1) and dfs(w) == 1:
      match[v] = u
      match[u] = v
      return 1
  return 0

for a in range(n):
  for b in range(n):
    if red[a][0] < blue[b][0] and red[a][1] < blue[b][1]:
      add_edge(a,b+n)

ans = 0
for a in range(n):
  if match[a] < 0:
    used = [0]*n
    if dfs(a) == 1:
      ans += 1
print ans


Measured memory_bytes: 2696
#include <bits/stdc++.h>
using namespace std;
//cin.sync_with_stdio(false);

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

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> Vector;
typedef vector<Vector>	DVector;

int main(int argc, char const *argv[])
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	ull x, y;
	cin >> x >> y;

	ull ans = 1;
	int check = -1;
	ull limit = pow(10, 18);
	//cout << "error_1" << endl;
	//cout << limit << endl;
	for (int i = 2; ans < limit; ++i)
	{
		//cout << "error_2" << endl;
		//cout << ans << endl;
		if(i == 2){
			if (x % y == 0)
			{
				break;
			}
		}
		ans = x*i;
		if(ans % y != 0){
			check = 0;
			break;
		}
	}
	//cout << "error_3" << endl;
	if (check == 0)
	{
		cout << ans << endl;
	}else{
		cout << check << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define inf 1072114514000

long long max(long long a,long long b){
  if(a>b){return a;}
  return b;
}

long long min(long long a,long long b){
  if(a<b){return a;}
  return b;
}

int main(){
  long long n,i,j,r,f,t,k;
  long long s,d;
  scanf("%lld",&n);
  for(i=0;i<n;i++){
    scanf("%lld%lld",&s,&d);
    r=0;
    f=-inf;
    do{
      for(j=0;j<60;j++){
        if((s+(1ll<<j))>d){break;}
        f=max(s+(1ll<<j),f);
        if((s&(1ll<<j))!=0){break;}
      }
      s=f;
      r++;
    }while(s!=d);
    printf("%lld\n",r);
  }
  return 0;
}



Measured memory_bytes: 2036
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow2(int x, int n){
  ll ans = 1;
  REP(i,n){
    ans *= x;
  }
  return ans;
}

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}

ll cube(ll x){
  return x*x*x;
}


/*
n k

n k 2*10^5
 */
int n,k;

int main(){
  cin>>n>>k;
  if(k%2==0){
    cout<< pow(n/k,3) + pow((2*n+k)/(2*k),3) <<endl;
  } else {
    cout<< pow(n/k,3) <<endl;    
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stack>
#include<vector>
#include<string>
#include<algorithm>
#include<stdlib.h>
using namespace std;

int main()
{
	stack<int> S1;
	stack< pair<int, int> > S2;
	char c_s;
	int sum;
	int a, i, j;
	for(i; cin >> c_s; i++)
	{
		if(c_s == '\\') S1.push(i);
		else if(c_s == '/' && S1.size() > 0)
		{
			j = S1.top(); S1.pop();
			sum += i - j;
			a = i - j;
			while( S2.size() > 0 && S2.top().first > j ) // This is important.
			{
				a += S2.top().second; S2.pop();
			}
			S2.push(make_pair(j, a));
		}
	}
	
	vector<int> ans;
	while(S2.size() > 0) { ans.push_back(S2.top().second); S2.pop();}
	reverse(ans.begin(), ans.end());
	cout << sum << endl;
	cout << ans.size();
	for (int i=0; i < ans.size(); i++)
	{
		cout << " ";
		cout << ans[i];
	}
	cout << endl;
//	system("pause");
	return 0;
}



Measured memory_bytes: 3184
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
ll x;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>x;
    ll p=100,ans=0;
    while(p<x){
        p+=p/100;
        ans++;
    }
    cout<<ans<<endl;
}

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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int ans = 0;
    rep (i, s.size()) ans += (s[i] - '0');
    cout << ans << endl;
    
    return 0;
}



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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 505;

int n, P, r[N], l[N], f[N];

int main() {
	read(n), read(P);
	std::vector<std::pair<int, int>> a;
	for (int i = 0; i < n; ++i) {
		r[i] = sqrt(4 * n * n - i * i) + 1e-9 + 1;
		r[i] = std::min(r[i], 2 * n);
		l[i] = sqrt(n * n - i * i - 1) + 1e-9 + 1;
		a.push_back({l[i], -i});
	}
	for (int i = n; i < 2 * n; ++i) {
		r[i] = sqrt(4 * n * n - i * i) + 1e-9 + 1;
		r[i] = std::min(r[i], 2 * n);
		a.push_back({r[i], -i});
	}
	std::sort(a.begin(), a.end());
	int dfcmd = 0;
	for (int k = 0; k <= n; ++k) {
		for (int i = 0; i <= n; ++i) {
			f[i] = 0;
		}
		f[0] = 1;
		int c0 = 0, c1 = 0;
		for (auto v : a) {
			int id = -v.second;
			if (id >= n) {
				for (int i = c0; ~i; --i) {
					f[i] = 1ll * f[i] * (r[id] - i - c1) % P;
				}
				++c1;
			} else {
				for (int i = c0 + 1; ~i; --i) {
					f[i] = 1ll * f[i] * (r[id] - k - n - (c0 - i)) % P;
					if (i) {
						f[i] = (f[i] + 1ll * f[i - 1] * (l[id] - (i - 1) - c1)) % P;
					}
				}
				++c0;
			}
		}
		dfcmd = (dfcmd + (k & 1 ? -1 : 1) * f[k]) % P;
	}
	print((dfcmd + P) % P);
}


Measured memory_bytes: 3708
/*
  AOJ 1237
  Title:Shredding Company
  @kankichi573
*/
#include <stdio.h>
#include <string.h>
#include <limits.h>

int target;
char num[100];
int result[200];
int result2[200];
int lvl2;
int dbl;
int delta,min_delta;

int atoi_n(char s[],int len)
{
  char buf[100];
  strncpy(buf,s,len);
  buf[len]='\0';
  return atoi(buf);
}

int add_every_digit(char s[])
{
  int ret;
  for(ret=0;*s;s++)
    ret += (*s-'0');
  return(ret);
}

int keta(int n)
{
  if(n<10)
    return(1);
  else
    return 1+keta(n/10);
}


shred(char s[],int len,int target,int lvl)
{
  int i,n;

    if(target>=(n=atoi(s)))
      {
	delta=target-n;
	if(delta==min_delta)
	  dbl=1;
	else if(delta<min_delta)
	  {
	    dbl=0;
	    min_delta=delta;
	    result[lvl]=n;
	    memcpy(result2,result,(lvl+1)*sizeof(int));
	    lvl2=lvl;
	  }
      }

  if(len<=1)
    return;

  for(i=1;(n=atoi_n(s,i))<=target && s[i];i++)
    {
      result[lvl]=n;
      shred(s+i,len-i,target-n,lvl+1);
    }
}


main()
{
  int ret,len,sum,i;
  
  while(scanf("%d %s",&target,num)  && (target!=0 || atoi(num)!=0))
    {
      len=strlen(num);
      if(add_every_digit(num)>target)
	printf("error\n");
      else if(atoi(num)==target)
	printf("%d %d\n",target,target);
      else
	{

	  dbl=0;
	  min_delta=INT_MAX;
	  ret=shred(num,len,target,0);
	
	  if(dbl==0)
	    {
	      for(i=ret=0,sum=0;i<=lvl2;i++)
		ret+=result2[i];
	      printf("%d ",ret);
	      for(i=0,sum=0;i<=lvl2;i++)
		{
		  printf("%d",result2[i]);
		  if(i<lvl2)
		    printf(" ");
		}
	      printf("\n");
	    }
	  else
	    printf("rejected\n");
	}
    }
  return(0);
}

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

#define PI 4*atan(1)
#define INF 1e8

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

int main(){
  int A, B;
  cin >> A >> B;
  if(A == 1){
    if(B != 1)cout << "Alice" << endl;
    else cout << "Draw" << endl;
  }else {
    if(B == 1)cout << "Bob" << endl;
    else {
      if(A < B)cout << "Bob" << endl;
      else if(A > B)cout << "Alice" << endl;
      else cout << "Draw" << endl;
    }
  }
}


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

int main() {
  int N, sum = 0;
  cin >> N;
  for (int i = 1; i <= N; i *= 10) {
    sum += N / i % 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>

#define INF 1000000000000000000
using namespace std;
typedef long long ll;


int main() {
	int a, b, c;
	cin >> a >> b >> c;
	for (int i = 1; i <= b; i++) {
		if ((a*i%b) == c) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
//#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    string S; cin >> S;
    0 < 3 > 2 > 1 > 0 < 1 < 2 > 0 < 1 < 2 < 3 < 4 < 5 > 2 > 1 > 0 < 1;
    ll ans = 0, cntDai = 0, cntSho = 0;
    rep(i, S.size() - 1) {
        if(S[i] == '>' && S[i + 1] == '>') {
            cntSho++;
        }else if(S[i] == '<' && S[i + 1] == '<') {
            cntDai++;
        }else if(S[i] == '<' && S[i + 1] == '>') {
            cntDai++;
        }else if(S[i] == '>' && S[i + 1] == '<') {
            cntSho++;
            if(cntDai < cntSho) swap(cntDai, cntSho);
            ans += (cntDai + 1) * cntDai / 2;
            ans += (cntSho - 1) * cntSho / 2;
            //ans に加算
            cntSho = 0;
            cntDai = 0;
        }
    }
    if(S[S.size() - 1] == '>') ++cntSho;
    else ++cntDai;
    if(cntDai < cntSho) swap(cntDai, cntSho);
    ans += (cntDai + 1) * cntDai / 2;
    ans += (cntSho - 1) * cntSho / 2;

    cout << ans << endl;
}


Measured memory_bytes: 900
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        int a, b;
        cin >> a >> b;

        string s, t;
        for (int i = 0; i < b; ++i) {
            s += char(a + '0');
        }
        for (int i = 0; i < a; ++i) {
            t += char(b + '0');
        }

        if (s < t) {
            cout << s << endl;
        } else {
            cout << t << endl;
        }

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
/*  CREATED BY
    STREAM_CIPHER
    19-sep-2020
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define debug1(a) cout<<#a<<"="<<(a)<<"\n"
#define debug2(a,b) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<"\n"
#define debug3(a,b,c) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<","<<#c<<"="<<(c)<<"\n"
#define fix_precision(n) cout<<fixed<<setprecision(n)
#define all(a) a.begin(),a.end()
const double pi=acos(-1.0);
int inf=0x3f3f3f3f3f3f3f3f;
const int mod=1e9+7;
const int mx=5*1000000;//5*64M bit ->5*8M byte ->40MB size for long long int (64 bit)
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    #endif
        int n;
        cin>>n;
        int ans=0;
        for(int i=1;i<=n;i++)
        {
        	for(int j=i;j<=n/i;j++)
        	{
        		if(i*j<n)
        		{ 	
        			// debug2(i,j);
        			if(i!=j)
        				ans+=2;
        			else
        				ans++;
        		}
        	}
        }
        cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>

int main(void)
{
    char train[26 * 2];
    int pos;
    int n;
    char patrol[1025];
    int i, j;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%s", patrol);
        pos = 26;
        
        memset(train, ' ', sizeof(train));
        train[pos] = patrol[0];
        j = 1;
        while (patrol[j] != '\0'){
            j++;
            if (patrol[j] == '>'){
                pos++;
            }
            else {
                pos--;
            }
            train[pos] = patrol[++j];
            j++;
        }
        
        for (j = 0; j < 26 * 2; j++){
            if (train[j] != ' '){
                printf("%c", train[j]);
            }
        }
        printf("\n");
    }
    return (0);
}

Measured memory_bytes: 0
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#define N 810

using namespace std;

char a[N][N];
int dis[N][N];
int n,m,k,bx,by,Min,Ans;

void dfs(int x,int y,int s){
  if(s>k) return ;
  if(x==1||x==n||y==1||y==m) { puts("1"); exit(0); }
  if(dis[x][y]<=s) return ;
  dis[x][y]=s;
  int now=min(min(x-1,n-x),min(y-1,m-y));
  if(now<Min) Min=now;
  if(a[x+1][y]!='#') dfs(x+1,y,s+1);
  if(a[x-1][y]!='#') dfs(x-1,y,s+1);
  if(a[x][y+1]!='#') dfs(x,y+1,s+1);
  if(a[x][y-1]!='#') dfs(x,y-1,s+1);
}

inline int Ceil(int x,int y){
  if(x%y) return x/y+1;
  else return x/y;
}

int main(){
  scanf("%d%d%d",&n,&m,&k);
  for(int i=1;i<=n;i++) scanf("%s",a[i]+1);
  for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)
      if(a[i][j]=='S') bx=i,by=j;
  memset(dis,0x7f,sizeof(dis));
  Min=min(min(bx-1,n-bx),min(by-1,m-by));
  dfs(bx,by,0);
  Ans=1+Ceil(Min,k);
  printf("%d\n",Ans);
  return 0;
}


Measured memory_bytes: 3456
import java.util.*;
import java.io.*;
 
public class Main {
  public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	int[] a = new int[N];
	int count = 0;
	for(int i = 0; i < N; i++){
		a[i] = s.nextInt();
		if((i+1)%2==1 && a[i]%2==1) count++;
	}

	System.out.println(count);
    
  }
}

Measured memory_bytes: 35688
//#define LOCAL

#include <fstream>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <cstring>
#include <climits>
#include <set>

//#define int long long
typedef long long ll;
//using ll = long long;
//using R = double;

//#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

#define MOD 1000000007

const int INF = int(1e9);

using namespace std;

typedef vector<int> V;
typedef vector<V> VV;

signed main()
{
    int A, B, C, D;
    
    cin >> A >> B >> C >> D;
    cout << max(A * B, C * D) << endl;

    return 0;
}


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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

const int N = 200000;

// x^n
ll mod_pow(ll x, ll n) {
  if (n == 0) return 1;
  ll res = mod_pow(x * x % MOD, n / 2);
  if (n & 1) res = res * x % MOD;
  return res;
}

// x^{-1}
ll inv(ll x) { return mod_pow(x, MOD - 2); }

ll fact[N + 1];
ll fact_inv[N + 1];

void init_fact() {
  fact[0] = fact_inv[0] = 1;
  REP(i, N) {
    fact[i + 1] = fact[i] * (i + 1) % MOD;
    fact_inv[i + 1] = fact_inv[i] * inv(i + 1) % MOD;
  }
}

ll nCr(ll n, ll r) {
  if (n < r || n < 0 || r < 0) return 0;
  return fact[n] * fact_inv[r] % MOD * fact_inv[n - r] % MOD;
}

ll nPr(ll n, ll r) { return nCr(n, r) * fact[r] % MOD; }

int main() {
  int n;
  cin >> n;
  int a[n + 1];
  int pos[n + 1];
  REP(i, n + 1) {
    cin >> a[i];
    pos[i] = -1;
  }
  int l, r;
  REP(i, n + 1) {
    if (0 <= pos[a[i]]) {
      l = pos[a[i]], r = i;
    } else {
      pos[a[i]] = i;
    }
  }
  l++, r++;
  init_fact();
  REP1(k, n + 1) {
    ll res = (nCr(n + 1, k) - nCr(l - r + n, k - 1) + MOD) % MOD;
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define BE(x) (x).begin(), (x).end()

int main() {
    int n, m, a, b;
    cin >> n >> m;
    vector<vector<int>> v(n+1);
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }

    int s = v[1].size();
    for (int i = 0; i < s; i++) {
        int x = v[1][i];
        if (*max_element(BE(v[x])) == n) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 14988
N = int(input())
dp = [0]

for n in range(1, N+1):
    dp.append(dp[n-1]+1)
    exp = 6
    while exp <= n:
        dp[n] = min(dp[n], dp[n-exp] + 1)
        exp *= 6
    exp = 9
    while exp <= n:
        dp[n] = min(dp[n], dp[n-exp] + 1)
        exp *= 9

print(dp[-1])


Measured memory_bytes: 3860
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
string s,t;
cin>>s>>t;
ll q=s.size();
ll w=t.size();
string a;
ll ca=0;
ll p=-1;
for(ll i=0; i<q-w+1; i++){
a=s.substr(i,w);
while(ca<w){
if(a.at(ca)==t.at(ca)||a.at(ca)=='?') {
ca++;
continue;}
else{
break;}}
if(ca==w){
p=i;}
ca=0;}
if(p==-1){
cout<<"UNRESTORABLE"<<endl;}
else{
for(ll i=0; i<p; i++){
if(s.at(i)=='?'){
cout<<"a";}
else
cout<<s.at(i);}
cout<<t;
for(ll i=p+w; i<q; i++){
if(s.at(i)=='?'){
cout<<"a";}
else
cout<<s.at(i);}}}


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

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

class ll_mod {
public:
    typedef long long ll;
    ll x, MOD;

    ll_mod() {
        this->x = 0;
        this->MOD = ll(1e9)+7;
    }
    ll_mod(ll x, ll MOD) {
        this->x = x;
        this->MOD = MOD;
    }

    ll_mod operator + (ll_mod rhs) {
        return ll_mod((this->x + rhs.x) % this->MOD, this->MOD);
    }
    ll_mod operator - (ll_mod rhs) {
        return ll_mod((this->x + rhs.x) % this->MOD, this->MOD);
    }
    ll_mod operator * (ll_mod rhs) {
        return ll_mod((this->x * rhs.x) % this->MOD, this->MOD);
    }
    ll_mod operator * (ll x) {
        return ll_mod((this->x * x) % this->MOD, this->MOD);
    }
    ll_mod operator / (ll_mod rhs) {
        return ll_mod((this->x / rhs.x) % this->MOD, this->MOD);
    }
};

// x^n % MOD
ll_mod pow_MOD(ll_mod x, ll n) {
    if (n == 0) return ll_mod(1, MOD);
    if (n == 1) return x;

    ll_mod ret = pow_MOD(x, n/2);
    if (n%2 == 0) {
        return ret*ret;
    } else {
        return ret*ret*x;
    }
}

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

    int H, W, A, B; cin >> H >> W >> A >> B;
    vector<ll_mod> fact, inv_fact;
    fact.emplace_back(1, MOD); fact.emplace_back(1, MOD);
    for (ll i = 2; i < H+W; i++) {
        fact.emplace_back(fact[i-1]*i);
    }
    for (ll i = 0; i < H+W; i++) {
        inv_fact.emplace_back(pow_MOD(fact[i], MOD-2));
    }

    ll_mod ans(0, MOD);
    for (int i = B; i < W; i++) {
        ans = ans + fact[i+H-A-1]*inv_fact[i]*inv_fact[H-A-1] * \
            fact[A+W-i-2]*inv_fact[A-1]*inv_fact[W-i-1];
    }

    cout << ans.x << endl;

    return 0;
}

Measured memory_bytes: 9580
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int n, c, v[500000], mem[500000];
void solve(int l, int r) {
	if(r - l == 1) return; c += r - l;
	solve(l, (l + r) / 2);
	solve((l + r) / 2, r);
	merge(v + l, v + (l + r) / 2, v + (l + r) / 2, v + r, mem);
	for(int i = l; i < r; i++) v[i] = mem[i - l];
}
int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%d", &v[i]);
	solve(0, n);
	for(int i = 0; i < n; i++) {
		if(i) printf(" ");
		printf("%d", v[i]);
	}
	printf("\n%d\n", c);
}

Measured memory_bytes: 7160
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define ll long long
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define deb(x) cout << #x << "=" << x << endl;
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   


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

    ll fib[2005] = {0};
    fib[3] = 1;
    fib[4] = 1;
    fib[5] = 1;
    fib[6] = 2;
    for(int i = 7; i<=n; ++i) {
        fib[i] = (fib[i-2] + fib[i-3])%mod + fib[i-4];
        fib[i] %= mod;
    }
    cout<<fib[n]%mod<<endl;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int min,max,count=0;
  cin >> min >> max;
  for(;min <= max;min++) {
    int a5,a4,a2,a1;
    a5=min/10000;
    a4=min/1000%10;
    a2=min/10%10;
    a1=min%10;
    if(a5==a1 && a4==a2) count++;
}
  cout << count <<endl;
}

Measured memory_bytes: 256
def main():
    H,W = map(int,input().split())
    N = H*W
    #print(N//2)

    if H == 1 or W == 1:
        return 1
    elif N%2 == 0:
        ans = int(N/2)
    else:
        ans = int((N//2) + 1)

    return ans

print(main())


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

using namespace std;

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

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

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

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

	vector<ll> num(n+1,0);
	num[0] = 3;
	ll ans=1;
	rep(i,n){
		ans *= num[a[i]];
		ans%=mod;
		num[a[i]]=max(0LL,num[a[i]]-1);
		num[a[i]+1]++;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
    int s; cin >> s;
    int h = s / 3600;
    int m = (s - 3600 * h) / 60;
    int ans = s - 3600 * h - 60 * m;
    cout << h << ':' << m << ':' << ans << endl;
}


Measured memory_bytes: 3104
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d, e, f int
	fmt.Scan(&a, &b, &c, &d, &e, &f)
	sww := a * 100
	sw := 0
	for w1 := 0; w1 <= f; w1 += 100 * a {
		for w2 := 0; w1+w2 <= f; w2 += 100 * b {
			for s1 := 0; w1+w2+s1 <= f; s1 += c {
				for s2 := 0; w1+w2+s1+s2 <= f; s2 += d {
					if (w1+w2)/100*e < s1+s2 {
						break
					}
					if float64(sw)/float64(sww) < float64(s1+s2)/float64(s1+s2+w1+w2) {
						sww = s1 + s2 + w1 + w2
						sw = s1 + s2
					}
				}
			}
		}
	}
	fmt.Println(sww, sw)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
int main() {
  int n,m,mx,my,x,y; cin>>n>>m>>mx>>my;
  rep(i,n) cin>>x,mx=max(mx,x);
  rep(i,m) cin>>y,my=min(my,y);
  cout<<(mx<my?"No War":"War");
}

Measured memory_bytes: 3632
#include<cstdio>
using namespace std;
int main(){
  long n,m,ans=0;
  scanf("%ld %ld",&n,&m);
  if(n-m<=1&&n-m>=-1){
    if(n-m==0)
      ans=2;
    else
      ans=1;
    for(long i=1;i<=n;i++){
      ans=ans*i;
      ans%=1000000007;
    }
    for(long i=1;i<=m;i++){
      ans=ans*i;
      ans%=1000000007;
    }
  }
  printf("%ld\n",ans%1000000007);
}

Measured memory_bytes: 128
#include <stdio.h>
 
int main() {
  int x,y,a;
  scanf("%d %d",&x,&y);
 
  while(x != 0 || y !=0) {
    if(x > y) {
      a = x;
      x =y;
      y = a;
    } 
    printf("%d %d\n",x , y);
    scanf("%d %d" ,&x,&y);
  
  }
  return 0;
}


Measured memory_bytes: 2040
#include<stdio.h>
#include<stdlib.h>
#define N 100000
#define nil -1
#define WHITE 0
#define BLACK 1
#define INF 1<<21

 typedef struct{
                int prev,next,cost;
                }Edge;

 int n,d[N];
 Edge e[500000];

 void dijkstra(int);

 int main(){
            int i,j,u,k,c,ed=0,v,w=INF,r;

            scanf("%d",&n);
            for(i=0;i<n;i++){
                            scanf("%d%d",&u,&k);
                            for(j=0;j<k;j++){
                                            e[ed].prev=u;
                                            scanf("%d%d",&e[ed].next,&e[ed].cost);
                                            ed++;
                                             }
                             }
            dijkstra(ed);

            for(i=0;i<n;i++)printf("%d %d\n",i,d[i]);
     
            return 0;
            }


 void dijkstra(int edges){
                          int i,flag;
                          for(i=0;i<n;i++)d[i]=INF;
                          d[0]=0;

                          flag=1;
                          while(flag!=0){
                                      flag=0;
                                      for(i=0;i<edges;i++){
                                                  if(e[i].cost+d[e[i].prev]<d[e[i].next]){
                                                     d[e[i].next]=e[i].cost+d[e[i].prev];
                                                     flag=1;
                                             }
                                   }
                              }
                          }











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

int main() {
    LL a, b, k;
    cin >> a >> b >> k;

    LL x = min(a, k);
    a -= x;
    k -= x;

    LL y = min(b, k);
    b -= y;
    k -= y;

    cout << a << " " << b << endl;

    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main ()
{
    long long a,b,i,j;
    while(scanf("%lld %lld",&a,&b)!=EOF){
       j=a+b;
for( i=0;j!=0;i++)
{
    j=j/10;
}

 printf("%lld\n",i);
    }

    return 0;

}



Measured memory_bytes: 2048
n = gets.chomp.to_i
t = []
x = []
y = []
n.times do |i|
  t[i], x[i], y[i] = gets.chomp.split.map(&:to_i)
end

n.times do |i|
  if i == 0
    tt = t[i]
    xx = x[i]
    yy = y[i]
  else
    tt = t[i] - t[i-1]
    xx = (x[i] - x[i-1]).abs
    yy = (y[i] - y[i-1]).abs
  end
  dis = xx + yy
  u = tt - dis
  if u >= 0 && u.even?
  else
    puts 'No'
    exit
  end
end
puts 'Yes'


Measured memory_bytes: 4296
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func getPrimes(m int) []int {
	is_not_prime := make([]bool, m+1)
	is_not_prime[0] = true
	is_not_prime[1] = true
	primes := make([]int, 0)
	for i := 2; i <= m; i++ {
		if is_not_prime[i] {
			continue
		}
		primes = append(primes, i)
		for j := i * 2; j <= m; j += i {
			is_not_prime[j] = true
		}
	}
	return primes
}

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	N := nextInt()
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = nextInt()
	}

	primes := getPrimes(1000000)
	arg_primes := make(map[int]int)
	for i, p := range primes {
		arg_primes[p] = i
	}

	bucket := make([]bool, len(primes))
	pair_wise := true
	for i := 0; i < N; i++ {
		a := A[i]
		if a == 1 {
			continue
		}
		for j := 0; primes[j] < 1000; j++ {
			if a%primes[j] == 0 {
				if bucket[j] {
					pair_wise = false
					break
				}
				for a%primes[j] == 0 {
					a = a / primes[j]
				}
				bucket[j] = true
			}
			if a == 1 {
				break
			}
		}
		if a > 1000 && pair_wise {
			k := arg_primes[a]
			if bucket[k] {
				pair_wise = false
			} else {
				bucket[k] = true
			}
		}
		if !pair_wise {
			break
		}
	}

	if pair_wise {
		fmt.Println("pairwise coprime")
		return
	}

	p_kouho := make([]int, 0)
	a0 := A[0]
	for j := 0; primes[j] < 1000; j++ {
		if a0%primes[j] == 0 {
			p_kouho = append(p_kouho, primes[j])
			for a0%primes[j] == 0 {
				a0 = a0 / primes[j]
			}
		}
		if a0 == 1 {
			break
		}
	}
	if a0 > 1000 {
		p_kouho = append(p_kouho, a0)
	}

	set_wise := false
	for i := 1; i < N; i++ {
		a := A[i]
		next_p := make([]int, 0)
		for _, p := range p_kouho {
			if a%p == 0 {
				next_p = append(next_p, p)
			}
		}
		if len(next_p) == 0 {
			set_wise = true
			break
		}
		p_kouho = next_p
	}

	if set_wise {
		fmt.Println("setwise coprime")
	} else {
		fmt.Println("not coprime")
	}
}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

ll com(ll N, ll R){
        if(R < 0 || R > N) return 0;
        if(R == 1) return N;
        else if(R == 2) return N*(N-1)/2;
        else return N*(N-1)*(N-2)/6;
}

string S;
int N,K;

ll rec(int i, int k, int smaller){//i桁目以降について、0以外の値をK個使用可能、完全に小か否かを考える。
    if(i == N){
        if(k == 0) return 1;
        else return 0;
    }
    if(k == 0) return 1;

    if(smaller) return com(N-i,k)*pow(9,k);
    else{
        if(S[i]=='0')return rec(i+1,k,false);
        else{
            ll zero = rec(i+1,k,true);
            ll aida = rec(i+1,k-1,true)*(S[i]-'1');
            ll same = rec(i+1,k-1,false);
            return zero+aida+same;
        }
    }
}

int main(){
    cin>>S>>K;
    N = S.size();
    cout<<rec(0,K,false)<<endl;
}


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

const ll MAX = 2 * 1e5 + 10;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int N, K, A[MAX];

int main(){
    cin >> N >> K;
    rep(i, N) cin >> A[i];

    map<int, int> m;
    rep(i, N){
        m[ A[i] ]++;
    }

    vector<int> v;
    for(auto i : m){
        v.push_back(i.second);
    }

    sort(v.begin(), v.end(), greater<int>());

    int num = 0;
    rep(i, v.size()){
        if(K <= i) break;
        num += v[i];
    }
    
    cout << N - num << endl;
}

Measured memory_bytes: 11516
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
	int n;
	cin >> n;
	string a;
	cin >> a;
	for(int i=0;i<a.size();i++)
	{
		a[i]+=n;
		if(a[i]>'Z') a[i]-=26;
	}
	cout << a;
	return 0;
}

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

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

    vector<int> a(n), visited(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    int i = 0, cnt = 0;
    while (visited[i] == 0 && i != 1) {
        visited[i]++;
        cnt++;
        i = a[i] - 1;
    }
    if (i == 1) {
        cout << cnt << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}

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

      String S =sc.next();
      String T =sc.next();
      int count =0;
      
    if(S.substring(0,1).equals(T.substring(0,1))){
        count++;   
      }
    if(S.substring(1,2).equals(T.substring(1,2))){
      count++;
      }
    if(S.substring(2,3).equals(T.substring(2,3))){
      count++;
    }
     System.out.print(count);
    }
}

Measured memory_bytes: 20820
//#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int N;
	cin >> N;
	cout << (N + 1) / 2 << "\n";
	return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
#include <math.h>
#include <regex>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
ld n , d;
vector<vector<ld>> x(n,vector<ld>(d));

int main(){
    ll n ; cin >> n;
    ll ans = 0;
    for(int i=0;i<=n;i++){
        if(i%3!=0 && i%5!=0){
            ans+=i;
        }
    }
    cout << ans << endl;
    return 0;
}

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


int main(){
        int n, k, q, a;
        cin >> n >> k >> q;

        vector<int> score(n, k-q);

        for (int i = 0; i < q; ++i){
                cin >> a ;
                score[a-1] += 1 ;
        }
        for (int j = 0; j < n; ++j){
                if (score[j] > 0) {
                        cout << "Yes" << endl;
                }else{
                        cout << "No" << endl;
                }
        }
}

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

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 long long INF = 1LL << 60;
const long long MAX_N = 1e2 + 10;
const long long MAX_V = 1e5 + 10;

int N, W, w[MAX_N], v[MAX_N];
long long dp[MAX_N][MAX_V];

int main()
{
	cin >> N >> W;
	for (int i = 0; i < N; ++i)
	{
		cin >> w[i] >> v[i];
	}

	for (int i = 0; i < MAX_N; ++i)
	{
		for (int j = 0; j < MAX_V; ++j)
		{
			dp[i][j] = INF;
		}
	}

	dp[0][0] = 0;

	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < MAX_V; ++j)
		{
			if (j - v[i] >= 0)
				chmin(dp[i + 1][j], dp[i][j - v[i]] + w[i]);
			chmin(dp[i + 1][j], dp[i][j]);
		}
	}
	long long res = 0;
	for (int i = 0; i < MAX_V; ++i)
	{
		if (dp[N][i] <= W)
		{
			res = i;
		}
	}

	cout << res << endl;
}

Measured memory_bytes: 86144
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(R): #104-A
    if 1200>R :
        return 'ABC'
    if 2800>R :
        return 'ARC'
    else:
        return 'AGC'

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    return int(line)

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <sstream>
#include <limits.h>
using namespace std;

int main()
{
    char n;
    cin >> n;
    /*
    int a[n];
    std::vector<int> v;
    for(int i=0; i<n; i++){
        int tmp;
        cin >> tmp;
        a[i] = tmp;
    }
    */
    int a = n;
    if(a >= 65 && a<=90) cout << "A" << endl;
    else cout << "a" << endl;
    //cout << "Yes" << endl;
    //cout << a << endl;
    
    return 0;
}

Measured memory_bytes: 3616
s = list(input())
if s[2:-1] .count('C')==1 and s[0]=='A':
  tmp = s.index('C')
  s.pop(tmp)
  s.pop(0)
  a = str(''.join(s))
  if a.islower()==True:
    print('AC')
    exit()  
print('WA')

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

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

            int a =Convert.ToInt32(input[0]);

            int b = Convert.ToInt32(input[1]);

            int c = a - 1;

            int d = b - 1;

            if (a < b)
            {
                Console.WriteLine(b + d);
            }
            else if (b < a)
            {
                Console.WriteLine(a + c);
            }
            else
            {
                Console.WriteLine(a + a);
            }
            Console.Read();
        }
    }
}

Measured memory_bytes: 11220
/*
Author : N_o_o_B
Created : April 12 2020 17:35:00 
*/
#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 TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n;
    cin >> n;
    ll ans = 0;
    rep(i,1,n){
        rep(j,1,n){
            rep(k,1,n){
                ans += __gcd(__gcd(i,j),k);
            }
        }
    }
    cout << ans << endl;


    time_taken();
    return 0;
}

Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
long long l,a,b,m,L,R,mid,fuck,fk,dur,cur;
struct mat
{
	long long a[11][11];
	mat()
	{
		for (int i=1;i<=3;i++)
		{
			for (int j=1;j<=3;j++)
			a[i][j]=(i==j);
		}
	}
	mat operator * (const mat &u) const
	{
		mat res;
		for (int i=1;i<=3;i++)
		{
			for (int j=1;j<=3;j++)
			{
				res.a[i][j]=0;
				for (int k=1;k<=3;k++)
				{
					res.a[i][j]=(res.a[i][j]+a[i][k]*u.a[k][j])%m;
				}
			}
		}
		return res;
	}
}ma,ans,fp;
mat binpow(mat a,long long t)
{
	mat res,p=a;
	for (long long i=t;i;i>>=1)
	{
		if (i&1) res=res*p;
		p=p*p; 
	}
	return res;
}
int main()
{
	scanf("%lld%lld%lld%lld",&l,&a,&b,&m);
	cur=a;
	while(l)
	{
		fuck=1;fk=cur;
		while(fk)
		{
			fk/=10;
			fuck*=10;
		}
		ma.a[1][1]=fuck%m;ma.a[1][2]=ma.a[1][3]=ma.a[2][3]=ma.a[3][1]=0;
		ma.a[2][1]=ma.a[2][2]=ma.a[3][2]=ma.a[3][3]=1;
		dur=(fuck-cur+b-1)/b;
		dur=min(dur,l);
		fp=fp*binpow(ma,dur);
		l-=dur;cur+=b*dur;
	}
	printf("%lld\n",(fp.a[2][1]*(a%m)+fp.a[3][1]*(b%m))%m);
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#define white 0
#define black 1
int n,m,i,a,b,ans=0;
int col[9]={white};
int r[30][30];
void dfs(int u){
    //全て訪問したら終わり
    int v,j;
    //全て訪問したか確認
    for(i=1;i<=n;i++){
        if(col[i]==white)break;
        if(i==n){ans++;
            return;
        }
    }
    for(v=1;v<=n;v++){
        if(r[u][v]==1&&col[v]==white){
            col[v]=black;
            dfs(v);
            col[v]=white;
        }
    }
    return;
    
}
int main(void){
    int i,j,a,b;
    //n頂点、m辺
    scanf("%d %d",&n,&m);
    //m個の辺.頂点a[i]とb[i]をつなぐ
    for(i=1;i<=m;i++){
        scanf("%d %d",&a,&b);
        r[a][b]=1;
        r[b][a]=1;
    }
    col[1]=black;
    dfs(1);
    printf("%d\n",ans);
        }

Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	string a,b,k;
	int i,j,c,d;
	cin>>a>>b>>c>>d>>k;
	if(k==a) c--;
	if(k==b) d--;
	cout<<c<<" "<<d;
}

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

int main()
{
    int a,b,c;
    while (scanf("%d%d%d",&a,&b,&c)!=EOF)
    {
        if (a>=b&&a>=c)
            printf("%d\n",b+c);
        else if (b>=a&&b>=c)
            printf("%d\n",a+c);
        else
            printf("%d\n",a+b);
    }
    return 0;
}

Measured memory_bytes: 128
n = int(input())
hList=list(map(int,input().split()))
count = 0
maxCount = 0
prev = hList[0]
for i in range(1,n):
    if hList[i] <= prev:
        count += 1
        if count >= maxCount:
            maxCount = count
    else:
        count = 0
    prev = hList[i]
print(maxCount)

Measured memory_bytes: 15020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n;
  cin>>n;
  int a[n];
  queue<int> q;
  for(int i=0;i<n;i++) cin>>a[i],q.push(i);
  if(n==1) {
    cout << "no" << endl;
    return 0;
  }
  bool dp[n][n],m[n];
  memset(dp,0,sizeof(dp));
  for(int i=0;i<n;i++) dp[i][i]=1;
  while(!q.empty()){
    int p=q.front();q.pop();
    //cout<<p<<endl;
    vector<int> vl(1,p),vr(1,p);
    memset(m,0,sizeof(m));
    m[p]=1;
    for(int j=p+2;j<n;j++) if(dp[p+1][j]) m[j]=1;
    for(int j=p-2;j>=0;j--) if(dp[j][p-1]) m[j]=1;
    for(int i=p+1;i<n;i++){
      //if(p==1&&i==4) cout<<m[i-1]<<" "<<(a[i]==a[p])<<endl;
      if(m[i-1]&&a[i]==a[p]){
	vr.push_back(i);
	m[i]=1;
	//cout<<p<<" "<<i<<endl;
      }
      if(m[i]){
	for(int j=i+1;j<n;j++) if(dp[i][j]) m[j]=1;
      }
    }
    for(int i=p-1;i>=0;i--){
      if(m[i+1]&&a[i]==a[p]){
	vl.push_back(i);
	m[i]=1;
      } 
      if(m[i]){
	for(int j=i-1;j>=0;j--) if(dp[j][i]) m[j]=1;
      }
    }
    for(int i=0;i<(int)vl.size();i++){
      bool ff=0;
      for(int j=0;j<(int)vr.size();j++){
	//cout<<vl[i]<<" "<<vr[j]<<endl;
	if(dp[vl[i]][vr[j]]) continue;
	//cout<<vl[i]<<" "<<vr[j]<<endl;
	dp[vl[i]][vr[j]]=1;
	ff=1;
	if(vr[j]+1<n) q.push(vr[j]+1);
	for(int k=vr[j]+2;k<n;k++){
	  if(dp[vr[j]+1][k]&&!dp[vl[i]][k]){
	    dp[vl[i]][k]=1;
	    //cout<<vl[i]<<" "<<k<<endl;
	    if(k+1<n) q.push(k+1);	    
	  }
	}
	for(int k=vl[i]-2;k>=0;k--){
	  if(dp[k][vl[i]-1]&&!dp[k][vr[j]]){
	    dp[k][vr[j]]=1;
	    //cout<<k<<" "<<vr[j]<<endl;
	    if(k) q.push(k-1);	    
	  }
	}
      }
      if(ff&&vl[i]) q.push(vl[i]-1);
    }
  }
  cout<<(dp[0][n-1]?"yes":"no")<<endl;
  return 0;
}

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

int main() {
  int a, b;
  
  cin >> a >> b;

  if ( a * b % 2 == 0 ) {
    cout << "Even" << endl; 
  }
  else  {
    cout << "Odd" << endl;
  } 
}
 
  


Measured memory_bytes: 256
/*;

THE BEST IS YET TO COME

*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define r(i, s, l) for (int i = s; i < l; i++)
#define rr(i, s, l) for (int i = s; i >= l; i--)
#define mod 1000000007
#define INT_BITS 32
#define ld long double
#define pp pair<int, int>
#define ss second
#define ff first
#define INF 1e18
#define N 2000005
#define all(a) a.begin(), a.end()
#define pb push_back
#define vi vector<int>
#define vip vector<pair<int, int>>
#define endl "\n"
#define ln length()
#define sz size()
using namespace std;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int n;
vi a(100005);
int dp[100005];

signed main()
{

    fast();

    cin >> n;
    r(i, 0, n)
       cin >>a[i];
   
    dp[0] = 0;
    dp[1] = abs(a[0]-a[1]);
    r(i,2,n)
    dp[i] = min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));

    cout<<dp[n-1];


    return 0;
}



Measured memory_bytes: 4724
N = int(input())
a = []
flag = 0
for i in range(0,N):
	a.append(int(input()))
state = 1
for i in range(0,N):
	state = a[state-1]
	if state == 2:
		flag = 1
		t = i
		break
if flag:
	print(t+1)
else:
	print(-1)

Measured memory_bytes: 7084
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  string T; cin >>T;
  bool hantei=true;
  if(N%2==1){
    cout<<"No"<<endl;
    return 0;
  }
  for(int i=0;i<(N/2);i++){
    //cout<<T[i]<<T[i+N/2]<<endl;
    if(T[i]==T[i+N/2]){
      hantei=true;
    }else{
      hantei=false;
      break;
    }
  }
  if(hantei){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256