akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

class program
{
  static void Main(string[] args)
  {
    string s = Console.ReadLine();
    string t = Console.ReadLine();
    char[] s_ary = s.ToArray();
    char[] t_ary = t.ToArray();
    
    Array.Sort(s_ary);
    Array.Sort(t_ary);
    Array.Reverse(t_ary);
    
    string s_ = string.Join("",s_ary);
    string t_ = string.Join("",t_ary);
    
    string ans = "No";
    
    if (String.Compare(s_,t_) == -1)
    {
      ans = "Yes";
    }
    
    Console.WriteLine(ans);
  }
}

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

int main() {
        int k, t;
        cin >> k >> t;
        vector<int> a(t);
        for (int i = 0; i < t; i ++) cin >> a[i];
        sort(a.begin(), a.end());
        int ma = a[t- 1];
        int sum = k - ma;
        if (sum + 1 > ma) cout << 0 << endl; 
        else {
                cout << ma - (sum + 1) << endl;
        }
        return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime> 
#include <memory.h>
#include <assert.h>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18 + 1;

int main() {
    int R, G ,B, N;
    cin >> R >> G >> B >> N;

    int ans = 0;
    for(int r = 0; r <= N; r+=R) {
        for(int g = 0; g <= N; g+=G) {
            int b = N - (r + g);
            if (b >= 0 && b % B == 0) {
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){

int H, W, i;
string a;

cin >> H >> W;


for(i = 0; i < W + 2; i++){
    cout << "#" ;
}
cout << endl;


for(i = 0; i < H; i++){
    
    cin >> a;
    
    cout << "#" << a << "#" << endl;
    
}

for(i = 0; i < W + 2; i++){
    cout << "#" ;
}
cout << endl;
    
}


Measured memory_bytes: 3024
#pragma warning(disable: 4996)
#include<stdio.h>

int a, b, c;

int main() {
	scanf("%d %d %d", &a, &b, &c);
	if (a < b && b < c && a < c) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
}



Measured memory_bytes: 2148
void call(int n){
	int i;
	for (i = 1; i <= n; i++){
		int x = i;
		if (x % 3 == 0){
			printf(" %d", i);
		}
		else{
			while (x != 0){
				if (x % 10 == 3){
					printf(" %d", i);
					break;
				}
				else{
					x = x / 10;
				}
			}
		}
	}
	printf("\n");
}


int main(void){
	int n = 0;
	int i = 0;

	scanf("%d", &n);
	call(n);
	return 0;
}

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

using namespace std;

int main(void)
{
    int N, T; cin >> N >> T;

    int menor_custo = INT_MAX;
    int menor_tempo = INT_MAX;


    for(int i = 0; i < N; ++i)
    {
        int a, b; cin >> a >> b;

        if(b <= T)
        {    
            if(menor_custo > a)
                menor_custo = a;
        }

    }

    if(menor_custo == INT_MAX)
        cout << "TLE\n";
    else
        cout << menor_custo << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
using namespace std;
 
int main()
{
  int x,y,t,n,map[200][200],d[200][200],color[200][200],a,b,sum;
  int H[6][2]={{-1,-1},{0,-1},{-1,0},{1,0},{0,1},{1,1}};
  queue<pair<int,int> > Q;
  pair<int,int> u;
  while(1){
    cin>>t>>n;
    if(t==0&&n==0)break;
    sum=0;
    for(int i=0;i<200;i++){
      for(int j=0;j<200;j++){
	map[i][j]=0;
	d[i][j]=401;
	color[i][j]=0;
      }
    }
    for(int i=0;i<n;i++){
      cin>>x>>y;
      map[100+x][100+y]=1;
    }
    cin>>x>>y;
    x+=100;
    y+=100;
    sum++;
    d[x][y]=0;color[x][y]=1;
    Q.push(make_pair(x,y));
    while(!Q.empty()){
      u=Q.front();Q.pop();
      a=u.first;b=u.second;
      for(int i=0;i<6;i++){
	if(map[a+H[i][0]][b+H[i][1]]==0 && color[a+H[i][0]][b+H[i][1]]==0){
	  d[a+H[i][0]][b+H[i][1]]=d[a][b]+1;
	  color[a+H[i][0]][b+H[i][1]]=1;
	  if(d[a+H[i][0]][b+H[i][1]]<=t){
	    sum++;
	    Q.push(make_pair(a+H[i][0],b+H[i][1]));
	  }
	}
	color[a][b]=2;
      }
    }
    cout<<sum<<endl;
  }
  return 0;
}

Measured memory_bytes: 1688
import sys
def input():
    return sys.stdin.readline()[:-1]

def code():
    N = int(input())
    l = list(map(int, input().split()))
    tmp = 0
    ans = 0
    p = l[0]
    for i in range(1,N):
        k = l[i]
        if p>=k:
            tmp += 1
        else:
            ans = max(ans,tmp)
            tmp = 0
        p = k
    ans = max(ans,tmp)
    print(ans)

if __name__=='__main__':
    code()

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

int main(){
  string s;
  cin >> s;
  if(s == "ARC"){
    cout << "ABC" << endl;
  }else{
    cout << "ARC" << endl;
  }
}


Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] h = new int[N];
		int ans = 0;
		
		for(int i = 0; i < N; i++) {
			h[i] = sc.nextInt();
			if(h[i] >= K) {
				ans++;
			}
		}
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 48984
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<map>

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<b;++i)
#define fj(a,b) for(int j=a;j<b;++j)
#define fo(a,b) for(int o=a;o<b;++o)
#define fdi(a,b) for(int i=a-1;i>=b;--i)
#define fdj(a,b) for(int j=a-1;j>=b;--j)
#define fdo(a,b) for(int o=a-1;o>=b;--o)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
//////////////////////


void bad(){
	printf("No\n");
	exit(0);
}

void solve(){
	
}

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);

	int a, b;
	cin >> a >> b;
	string s;
	cin >> s;
	if(s[a] != '-') bad();
	fi(0, sz(s)){
		if(i == a) continue;
		if(!('0' <= s[i] && s[i] <= '9')) bad();
	}
	

	printf("Yes\n");

	return 0;
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    ll a, b, k; cin >> a >> b >> k;
    int ans1 = 0, ans2 = 0;
    if (a > k) {
        cout << a - k << " " << b << endl;
        return 0;
    } else {
        if (b > (k - a)) {
            cout << 0 << " " << b - (k - a) << endl;
            return 0;
        } else {
            cout << 0 << " " << 0 << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 888
n,m=map(int,input().split())
lst=[]
for i in range(n):
    lst.append(list(map(int,input().split())))
ppp=[lst[i][0]+lst[i][1]+lst[i][2] for i in range(n)]
ppm=[lst[i][0]+lst[i][1]-lst[i][2] for i in range(n)]
pmp=[lst[i][0]-lst[i][1]+lst[i][2] for i in range(n)]
pmm=[lst[i][0]-lst[i][1]-lst[i][2] for i in range(n)]
ppp.sort()
ppm.sort()
pmp.sort()
pmm.sort()
ppps=0
ppms=0
pmps=0
pmms=0

for i in range(m):
    ppps-=ppp[i]
    ppms-=ppm[i]
    pmps-=pmp[i]
    pmms-=pmm[i]
ans=max(ppps,ppms,pmps,pmms)
ppp.reverse()
ppm.reverse()
pmp.reverse()
pmm.reverse()
ppps=0
ppms=0
pmps=0
pmms=0
for i in range(m):
    ppps+=ppp[i]
    ppms+=ppm[i]
    pmps+=pmp[i]
    pmms+=pmm[i]
cand=max(ppps,ppms,pmps,pmms)
print(max(ans,cand))

Measured memory_bytes: 3444
N = int(input())
T = [0] + list(map(int, input().split()))
M = int(input())
P = [0]
X = [0]
for _ in range(M):
    p, x = list(map(int, input().split()))
    P += [p]
    X += [x]
    
for i in range(1, M + 1):
    print(sum(T[1:]) - (T[P[i]] - X[i]))


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

using namespace std;

struct Student {
    int no;
    int record;
};

bool asc(const Student& s1, const Student& s2) {
    return s1.record < s2.record;
}

int main() {
    int N;
    vector<Student> students;

    cin >> N;

    for(int i = 1; i <= N; i++) {
        Student student;
        student.no = i;
        cin >> student.record;
        students.push_back(student);
    }

    sort(students.begin(), students.end(), asc);

    for(int i = 0; i < students.size(); i++) {
        cout << students[i].no << endl;
    }

    return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll A,B;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B;
	
	if(A<=0 && B>=0) return _P("Zero\n");
	
	if(B<0 && (B-A)%2==0) return _P("Negative\n");
	_P("Positive\n");
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

int main() {
  int N;
  cin >> N;
  int TASU = 0;
  vector<int> a(N);
     for (int i = 0; i < N; i++) {
    cin >> a.at(i);
       TASU += a.at(i);
  } 
  cout << TASU-N << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=705;

inline int Get(int x){ return x*(x-1)>>1;}

int num[3],n,m,ans=1<<30,uu,vv,col[N],now;
bool f[N][N],g[N][N];

bool dfs(int x,int c){
	col[x]=c,num[c]++;
	
	for(int i=1;i<=n;i++) if(!g[x][i])
	    if(!col[i]){ if(!dfs(i,3-c)) return 0;}
	    else if(col[i]==c) return 0;
	
	return 1;
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	    scanf("%d%d",&uu,&vv),g[uu][vv]=g[vv][uu]=1;
	
	f[0][0]=1;
	for(int i=1;i<=n;i++) g[i][i]=1;
	
	for(int i=1;i<=n;i++) if(!col[i]){
		num[1]=num[2]=0;
		if(!dfs(i,1)){ puts("-1"); return 0;}
		
		now++;
		for(int j=0;j<=n;j++) if(f[now-1][j]) f[now][j+num[1]]=f[now][j+num[2]]=1;
	}
	
	for(int i=0;i<=n;i++) if(f[now][i]) ans=min(ans,Get(i)+Get(n-i));
	
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1280
import sys
from collections import deque
input = sys.stdin.readline

def main():
    n, k = map(int, input().split())
    s = list(input())
    
    tank = []
    cnt = 1
    for i in range(1, n):
        if s[i] != s[i-1]:
            tank.append(cnt)
            cnt = 0
        cnt += 1
        if i == n-1:
            tank.append(cnt)
            
    p = len(tank)
    
    if s[0] == '0' and (p+1)//2 <= k:
        print(n)
        exit()
    if p//2 <= k and s[0] == '1':
        print(n)
        exit()
        
    ans = 0
    res = 0
    if s[0] == '0':
        for j in range(2*k):
            res += tank[j]
        ans = res
        for j in range(2*k, p):
            if j == 2*k:
                res -= tank[0]
            elif j%2 == 0:
                res = res - tank[j-2*k] - tank[j-2*k-1]
            res += tank[j]
            ans = max(ans, res)
            
    else:
        for j in range(2*k+1):
            res += tank[j]
        ans = res
        for j in range(2*k+1, p):
            if j%2 == 1:
                res = res - tank[j-2*k-1] - tank[j-2*k]
            res += tank[j]
            ans = max(ans, res)
            
    print(ans)
    
if __name__ == '__main__':
    main()

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

using namespace std;
typedef long long ll;

template<typename T>
T gcd(T a, T b){
   if (a%b == 0){
       return(b);
   }
   else{
       return(gcd(b, a%b));
   }
}

template<typename T>
T lcm(T a,T b){
    return a*b/gcd(a,b);
}

int main(void){
    long double h,w,x,y;
    cin>>w>>h>>x>>y;
    cout<<w*h/2<<" ";
    if(x*2==w&&y*2==h){
        cout<<1;
    }
    else{
        cout<<0;
    }
}
/*

*/


Measured memory_bytes: 256
s = input().split()
fiveCNT = 0
sevenCNT = 0
if s[0] == '5':
    fiveCNT = fiveCNT + 1
elif s[0] == '7':
    sevenCNT = sevenCNT + 1
if s[1] == '5':
    fiveCNT = fiveCNT + 1
elif s[1] == '7':
    sevenCNT = sevenCNT + 1
if s[2] == '5':
    fiveCNT = fiveCNT + 1
elif s[2] == '7':
    sevenCNT = sevenCNT + 1
if fiveCNT == 2 and sevenCNT == 1:
    print('YES')
else:
    print('NO')


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


int main(int argc, char *argv[]){
	int N;
  	cin>>N;
	vector<int> A(N+1,0);
	for(int i=1; i<N+1; i++){
		int a;
		cin>>a;
		A[i]=a;
	}
	int count=1,res=0;
	for(int i=1; i<N+1; i++){
		if(A[i]==count) count++;
		else res++;
			
		}
  
  	if(res==N) cout<<-1<<endl;
	else cout<<res<<endl;
}

Measured memory_bytes: 1024
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n=ni()
dic= {}
for i in range(n):
    s=ns()
    if s in dic:
        dic[s]+=1
    else:
        dic[s]=1
maxnum=0
for i in dic.items():
    if maxnum<i[1]:
        maxnum=i[1]
ans=[]
for i in dic.items():
    if maxnum==i[1]:
        ans.append(i[0])
ans.sort()

for i in ans:
    print(i)




Measured memory_bytes: 32216
#include <stdio.h>
int main(){
  int a,b;
  char op;
  while(1){ scanf("%d %c %d",&a,&op,&b);
    if(op=='?')break; 
 if(op=='+'){printf("%d\n",a+b);
  }else if(op=='-'){printf("%d\n",a-b);
  }else if(op=='*'){printf("%d\n",a*b);
  }else if(op=='/'){printf("%d\n",a/b);
  }
  }
  return 0;
}

Measured memory_bytes: 600
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
#include<complex>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>
#include<random>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

const int MAXN = 1024;
pii P[MAXN];
bool dp[2][MAXN];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    while (cin >> N) {
        if (N==0) break;
        for (int i = 0; i < N; i++) cin >> P[i].first >> P[i].second;
        sort(P, P+N);
        int sum = 0;
        for (int i = 0; i < N-1; i++) sum += P[i].first;
        if (sum >= P[N-1].first) {
            int ans = 0;
            for (int i = 0; i < N; i++) ans += P[i].first+P[i].second;
            cout << ans << endl;
        } else {
            int diff = P[N-1].first - sum;
            memset(dp, false, sizeof(dp));
            dp[0][0] = true;
            for (int i = 0; i < N-1; i++) {
                int cur = i%2, tar = cur^1;
                for (int j = 0; j <= diff; j++) {
                    if (!dp[cur][j]) continue;
                    dp[tar][j] |= true;
                    int t = j+P[i].second;
                    if (t <= diff) dp[tar][t] |= true;
                }
            }
            int wsum = 0;
            for (int i = 0; i < N; i++) wsum += P[i].second;
            int t = diff;
            for (; t > 0; t--) if (dp[(N-1)%2][t]) break;
            cout << 2*P[N-1].first + (wsum-t) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
 
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define rep(i,n,z) for(int i=z;i<n;i++)
#define rrep(i,z) for(int i=z;i>=0;i--)
#define nl cout<<endl
#define vi vector<int>
#define vlli vector<long long int>
#define umap unordered_map
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define ipair pair <int,int>
#define llipair pair <lli,lli>
#define pq priority_queue
#define displaymatrix(a,m,n) for(int i=0;i<m;i++){for(int j=0;j<n;j++)cout<<a[i][j]<<" ";cout<<endl;}
#define printarray(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}nl;
#define vinput(a,n) vlli a(n);rep(i,n,0)cin>>a[i]
#define ainput(a,n) rep(i,n,0)cin>>a[i]
#define SO(a) sort(a.begin(),a.end())
#define all(x) (x).begin(),(x).end()
#define SOP(a,comp) sort(a.begin(),a.end(),comp)
#define inf INT_MAX
#define endl '\n'
 
int main()
{
    fastio;
    int h,w,k;
    cin>>h>>w>>k;
    int ans = 0;

    vector<string> a(h),b;

    rep(i,h,0)cin>>a[i];


    for(int i = 0;i < 1<<h;i++){
        for(int j = 0;j< 1<<w;j++){
            b = a;

            rep(I,7,0){
                if(i&(1<<I)){
                    rep(te,w,0)b[I][te] = 'R';
                }
            }

            rep(J,7,0){
                if(j&(1<<J)){
                    rep(te,h,0)b[te][J] = 'R';
                }
            }

            int count = 0;
            rep(I,h,0)
            rep(J,w,0)
            if(b[I][J] == '#')count++;
            if(count == k)ans++;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, a[200005], r[200005];
long long ans;
int main(){
	scanf("%d", &n);
	rep(i,n){
		scanf("%d", a+i);
		ans += r[a[i]]++;
	}
	rep(i,n) printf("%lld\n", ans - r[a[i]] + 1);
}

Measured memory_bytes: 3712
n, r, t = gets.split.map(&:to_i)
pase = (1..n).map { gets.to_i }
pos = Array.new(n, 0)
stock = Array.new(r, 0)
t.times do |k|
    empty = Array.new(r, 0)
    (0..n-1).each do |i|
        x = (pos[i] + pase[i]) % r
        empty[x] += 1 if k > 0
        stock[x] -= 1 if stock[x] > 0
        pos[i] = x
    end
    (0..r-1).each do |j|
        stock[j] += empty[j]
    end
end
p stock.inject(:+) + n


Measured memory_bytes: 14688
#include<iostream>
#include<cmath>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<cstdlib>
#include<queue>
#include<list>
using namespace std;

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


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a, b, c;
	int i;
	int count = 0;
	scanf("%d %d %d", &a, &b, &c);
	for(i = a; i <= b; i++) {
		if((c % i) == 0) count++;
	}
	printf("%d\n", count);
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vst = vector<st>;
using vchar = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  vvll bingo(3, vll(3));
  vrep(i, bingo)vrep(j, i) cin >> j;
  ll n;
  cin >> n;
  vll b(n);
  vin(b);
  vrep(i, b){
    vrep(j, bingo)vrep(k, j) if(i == k) k = 0;
  }
  bool ans = false;
  rep(i, 0, 3){
    if(bingo.at(i).at(0) == 0 && bingo.at(i).at(1) == 0 && bingo.at(i).at(2) == 0) ans = true;
    if(bingo.at(0).at(i) == 0 && bingo.at(1).at(i) == 0 && bingo.at(2).at(i) == 0) ans = true;
    if(bingo.at(0).at(0) == 0 && bingo.at(1).at(1) == 0 && bingo.at(2).at(2) == 0) ans = true;
    if(bingo.at(0).at(2) == 0 && bingo.at(1).at(1) == 0 && bingo.at(2).at(0) == 0) ans = true;
  }
  cout << (ans ? "Yes" : "No") << endl;
}

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

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

    int result = 0;
    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <= k; b++) {
            for (int c = 1; c <= k; c++) {
                result += gcd(a, gcd(b, c));
            }
        }
    }

    cout << result << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    int n;
    cin >> n;
    vector<int> v(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    deque<int> dq(v.begin(), v.end());
    vector<pair<int, int>> res;
    while (dq.size() > 2) {
        int n1 = dq.front();
        int n2 = dq.back();
        dq.pop_front();
        dq.pop_back();
        int next1 = n1 - n2;
        int next2 = n2 - n1;
        if (max(abs(next1 - dq.front()), abs(next1 - dq.back())) < max(abs(next2 - dq.front()), abs(next2 - dq.back()))) {
            dq.push_back(next2);
            res.push_back(make_pair(n2, n1));
        } else {
            dq.push_front(next1);
            res.push_back(make_pair(n1, n2));
        }
    }
    cout << dq.back() - dq.front() << endl;
    for (auto p : res) {
        cout << p.first << " " << p.second << endl;
    }
    cout << dq.back() << " " << dq.front() << endl;
}


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

#define mod 1000000007
#define ll long long

ll bow(ll x, ll y) {
  ll res = 1;
  for (ll i = 1; i <= y; ++i) {
    res = res * x % mod;
  }
  return res;
}

void solve() {
  ll n;
  cin >> n;
  ll ans = bow(10, n) - bow(9, n) - bow(9, n) + bow(8, n);
  ans %= mod;
  ans = (ans + mod) % mod;
  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}

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

int main() {
  int N,K;
  cin >> N >> K;

  vector<int64_t> math(N); // N個の数学の点数データ
  //vector<int64_t> english(N); // N個の英語の点数データ

  // 数学の点数データを受け取る
  for (int i = 0; i < N; i++) {
    cin >> math.at(i);
  }
  
  sort(math.begin(), math.end());
  
  int64_t count = 0;
  for (int i = 0; i < N-K; i++) {
    count += math.at(i);
  }
  
  cout << count <<endl;
}


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

int main(void){
    string s;
    cin >> s;

    string x = "";

    int n = s.size();

    for(int i = 0; i < n; i++){
        if(s.at(i) == '0'){
            x += '0';
        }
        else if(s.at(i) == '1'){
            x += '1';
        }
        else if( s.at(i) == 'B' && x.size() != 0){
            x = x.substr(0, x.size() - 1);
        }
    }

    cout << x << endl;
    return 0;
    
}

Measured memory_bytes: 256
from collections import Counter
from math import sqrt

#f_listとf_r_listの要素数は状況に応じて変えよう

MOD = (10 ** 9) + 7

list_size = 3 * (10 ** 5)

f_list = [1] * list_size
f_r_list = [1] * list_size

for i in range(list_size - 1):
	f_list[i + 1] = int((f_list[i] * (i + 2)) % MOD)

def power(n, x):
	if x == 1:
		return n
	elif x % 2 == 0:
		return power(int((n * n) % MOD), int(x / 2))
	else:
		return int((n * power(n, x - 1)) % MOD)

f_r_list[-1] = power(f_list[-1], MOD - 2)

for i in range(2, list_size + 1):
	f_r_list[-i] = int((f_r_list[-i + 1] * (list_size + 2 - i)) % MOD)

def comb(n, r):
	if n < r:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return (((f_list[n - 1] * f_r_list[n - r - 1]) % MOD) * f_r_list[r - 1]) % MOD 

#prime = [2]

def is_prime(i):
	if i == 1:
		return False
	#global prime
	for j in range(2, int(sqrt(i)) + 1):
		if i % j == 0:
			return False
	return True

n, m = map(int, input().split())
prime_factor = Counter()

for i in range(2, int(sqrt(m)) + 1):
	if m % i == 0:
		prime_factor[i] += 1
		m = m // i
		while m % i == 0:
			prime_factor[i] += 1
			m = m // i
	if is_prime(m):
		prime_factor[m] += 1
		break

ans = 1
for i in prime_factor.values():
	ans *= comb(n + i - 1, i)
	ans %= MOD
print(ans)



Measured memory_bytes: 27372
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int H,W,K;
char A[880][880];
int ans;
int dist[880][880];
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};

void bfs(pair<int,int> start){
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            dist[i][j]=MOD;
        }
    }
    dist[start.first][start.second]=0;
    queue<pair<int,int>> Q;
    Q.push(start);
    while(Q.size()){
        pair<int,int> now=Q.front();
        Q.pop();
        int x=now.first;
        int y=now.second;
        ans=min(ans,(x+K-1)/K);
        ans=min(ans,(y+K-1)/K);
        ans=min(ans,(H-1-x+K-1)/K);
        ans=min(ans,(W-1-y+K-1)/K);
        if(dist[x][y]==K) continue;
        for(int i=0;i<4;i++){
            int nx=x+dx[i];
            int ny=y+dy[i];
            if(nx<0||ny<0||nx>=H||ny>=W) continue;
            if(dist[nx][ny]<MOD) continue;
            if(A[nx][ny]=='#') continue;
            dist[nx][ny]=dist[x][y]+1;
            Q.push(make_pair(nx,ny));
        }
    }
    return;
}

/*void dfs(int x,int y,int cost){
    used[x][y]=true;
    ans=min(ans,(x+K-1)/K);
    ans=min(ans,(y+K-1)/K);
    ans=min(ans,(H-1-x+K-1)/K);
    ans=min(ans,(W-1-y+K-1)/K);
    if(cost==K) return;
    for(int i=0;i<4;i++){
        int nx=x+dx[i];
        int ny=y+dy[i];
        if(nx<0||ny<0||nx>=H||ny>=W) continue;
        if(used[nx][ny]) continue;
        if(A[nx][ny]=='#') continue;
        dfs(nx,ny,cost+1);
    }
    return;
}*/


int main(){
  cin>>H>>W>>K;
  pair<int,int> start;
  for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
          cin>>A[i][j];
          if(A[i][j]=='S') start=make_pair(i,j);
      }
  }
  ans=100000;
  bfs(start);

  cout<<ans+1<<endl;

  return 0;
}


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

int main(){
	char s;
	cin >> s;
	if(s == 'A'){
		cout << 'T' << endl;
	}else if(s == 'T'){
		cout << 'A' << endl;
	}else if(s == 'G'){
		cout << 'C' << endl;
	}else{
		cout << 'G' << endl;
	}
}

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

#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<cstdlib>

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<complex>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;


//4-side
//int xx[] = {0,0,-1,1};
//int yy[] = {-1,1,0,0};
//6-side hexagonal
//int xx[] = {2,-2,1,1,-1,-1};
//int yy[] = {0,0,1,-1,1,-1};

#define popc(a) (__builtin_popcount(a))
//ll bigmod(ll a,ll b,ll m){if(b == 0) return 1%m;ll x = bigmod(a,b/2,m);x = (x * x) % m;if(b % 2 == 1) x = (x * a) % m;return x;}
//ll BigMod(ll B,ll P,ll M){ ll R=1%M; while(P>0) {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;} /// (B^P)%M

#define MX 100005
#define inf 100000000

const double pi = acos(-1.0);
const ll mod = 1000000007ll;

pii pos[MX];
int cost[MX];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, m, d;
    scanf("%d %d %d", &n, &m, &d);
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
        {
            int x;
            scanf("%d", &x);
            pos[x] = make_pair(i,j);
        }
    for(int i = 1; i <= n*m; i++)
    {
        if(i<=d) continue;
        cost[i] = cost[i-d]+abs(pos[i].first-pos[i-d].first)+abs(pos[i].second-pos[i-d].second);
    }
    int q, l, r;
    scanf("%d", &q);
    while(q--)
    {
        scanf("%d %d", &l, &r);
        printf("%d\n", cost[r]-cost[l]);
    }
    return 0;
}



Measured memory_bytes: 2176
a=(`fold -1`)
op=('+' '-')
for o1 in ${op[@]}
do
    for o2 in ${op[@]}
    do
        for o3 in ${op[@]}
        do
            if((a[0]${o1}a[1]${o2}a[2]${o3}a[3]==7))
            then
                echo ${a[0]}$o1${a[1]}$o2${a[2]}$o3${a[3]}'=7'
                exit
            fi
        done
    done
done

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

#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
// constexpr ll mod = 1e9 + 7;

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

    int v[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    cout << v[K-1] << endl;


    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <limits>

#define ll long long int
int main() {
  std::string s;
  std::cin >> s;
  int bs = 0, ws = 0;
  for(int i = 0; i < s.length(); i++) {
    if(i % 2 == 0 && s.at(i) == '0') {
      bs++;
    } else if(i % 2 == 0 && s.at(i) == '1') {
      ws++;
    } else if(i % 2 == 1 && s.at(i) == '0') {
      ws++;
    } else {
      bs++;
    }
  }
  std::cout << (bs < ws ? bs : ws) << std::endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;
class RMQ{
public:
  ll n,dat[555555];
  void init(int _n){
    n=1;
    while(n<_n)n*=2;
    fill(dat,dat+2*n-1,-MAXL);
  }
  void update(ll k,ll a){
    k+=n-1;dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=max(dat[k*2+1],dat[k*2+2]);
    }
  }
  ll query(int a,int b){return query(a,b,0,0,n);}
  ll query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l) return -MAXL;
    if(a<=l&&r<=b) return dat[k];
    ll vl=query(a,b,k*2+1,l,(l+r)/2);
    ll vr=query(a,b,k*2+2,(l+r)/2,r);
    return max(vl,vr);
  }
};

void Main() {
  ll n;
  R n;
  RMQ r;
  r.init(n+1);
  r.update(0,0);
  rep(i,n) {
    ll x;
    R x;
    r.update(x,r.query(0,x)+x);
  }
  pr(n*(n+1)/2-r.query(0,n+1));
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 5296
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int m, k;
    cin >> m >> k;
    if (m == 0) {
        if (k == 0) {
            cout << 0 << " " << 0 << "\n";
        } else {
            cout << -1 << "\n";
        }
        return 0;
    }
    if (m == 1) {
        if (k == 0) {
            cout << 0 << " " << 0 << " " << 1 << " " << 1 << endl;
        } else {
            cout << -1 << "\n";
        }
        return 0;
    }
    if (k > (1 << m) - 1) {
        cout << -1 << "\n";
        return 0;
    }
    vi ret;
    ret.push_back(k);
    for (int i = 0; i < (1 << m); ++i) {
        if (i != k)
            ret.push_back(i);
    }
    ret.push_back(k);
    for (int i = (1 << m) - 1; i >= 0; --i) {
        if (i != k)
            ret.push_back(i);
    }
    print(ret);
    return 0;
}

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

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
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
ans = 0
dic = {'r': P, 's': R, 'p': S}
tmp = [''] * (N + 1)
for i in range(K):
    ans += dic[T[i]]
    tmp[i] = T[i]

for i in range(K, N):
    if T[i] != tmp[i - K]:
        ans += dic[T[i]]
        tmp[i] = T[i]
    else:
        tmp[i] = 't'
print(ans)

Measured memory_bytes: 4084
N = int(input())
a = [0]*(N+1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            d = x*x+y*y+z*z+x*y+y*z+x*z
            if d <= N:
                a[d] += 1
for i in range(1, N+1):
    print(a[i])


Measured memory_bytes: 69252
program sample
    implicit none
    character(100)::s,t
    integer(8) :: i,j,k,m,n,ans
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:),z(:)
  
    read(*,*) n,m
    allocate(x(m),y(m),z(n))
    do i=1,m
        read(*,*)x(i),y(i)
    end do
    z(:)=0
    do i=1,m
        z(x(i))=z(x(i))+1
        z(y(i))=z(y(i))+1
    end do

    do i=1,m+2
        a=0
        do j=1,m
            
            if(x(j)==0)then
                cycle
            elseif(z(x(j))==1 .or. z(y(j))==1 )then
                z(x(j))=z(x(j))-1
                z(y(j))=z(y(j))-1
                ans=ans+1
                x(j)=0
                y(j)=0
                a=1
            end if
        end do
        if(a==0)then
            write(*,*)ans
            stop
        end if

    end do

    stop
end program sample
  



Measured memory_bytes: 2768
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int A,B,C; R(A,B,C);
    int ma=max({A,B,C});
    int need=(ma*3-A-B-C);
    if(need&1)need+=3;
    W(need/2);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

int main(void){
        char s[10];
        int l = 0, i, cnt = 0;
        bool ok = true;
        while((s[l]=getchar())!='\n') l++;
        for(i=0; i<l; i++){
                if('a'<=s[i] and s[i]<='z') cnt++;
                else if(s[i]=='C') ok &= (1<i and i<l-1);
                else if(s[i]=='A') ok &= (i==0);
                else ok = false;
        }
        if(ok and cnt==l-2) puts("AC");
        else puts("WA");
        return 0;
}

Measured memory_bytes: 256
from heapq import heappop,heappush,heapify

class Graph():
    def __init__(self,n,edge,directed=False):
        self.n = n
        self.graph = [[] for _ in range(n)]
        for e in edge:
            self.graph[e[0]].append((e[1],e[2]))
            if not directed:
                self.graph[e[1]].append((e[0],e[2]))
                
    def prim(self):
        used = [False for _ in range(self.n)]
        used[0] = True
        heap = [(cost,adj) for adj,cost in self.graph[0]]
        heapify(heap)
        res = 0
        while heap:
            cost,node = heappop(heap)
            if used[node]:
                continue
            used[node] = True
            res += cost
            for adj,adjcost in self.graph[node]:
                if used[adj]:
                    continue
                heappush(heap,(adjcost,adj))
        return res
        
import sys
input = sys.stdin.readline

V,E = map(int,input().split())
edge = [tuple(map(int,input().split())) for _ in range(E)]

g = Graph(V,edge)

print(g.prim())


Measured memory_bytes: 45212
#include<stdio.h>
#include<math.h>

#define PI 3.14159265359

int main() {
	double coor[3] = { 0,0,90 };
	int length, angle;
	while (1) {
		scanf("%d,%d", &length, &angle);
		if (length == 0 && angle == 0)break;
		coor[0] += (double)length * cos((double)coor[2] * PI / 180);
		coor[1] += (double)length * sin((double)coor[2] * PI / 180);
		coor[2] -= angle;
	}
	printf("%d\n%d\n", (int)coor[0], (int)coor[1]);
	return 0;
}


Measured memory_bytes: 2848
int main(void)
{
	int A[100],i,j;
	
	scanf("%d", & i);
	
	for(j=0;j<=i-1;j++){
		scanf("%d", & A[j]);
	}
	for(j=i-1;j>=0;j--){
		printf("%d", A[j]);
		if(j!=0) printf(" ");
	}
	printf("\n");
	return 0;
}

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

int main(void) {
  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;
  if (S == U) {
    cout << A - 1 << " " << B << endl;
  } else {
    cout << A << " " << B - 1 << endl;
  }
  return 0;
}

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


int main() {
  string S;
  cin>>S;
  
  for(int i=0;i<S.size();i++){
    if(i%2==0){
      if(S.at(i)!='R'&&S.at(i)!='U'&&S.at(i)!='D'){
        cout<<"No"<<endl;
        return 0;
      }
    }
    else{
      if(S.at(i)!='L'&&S.at(i)!='U'&&S.at(i)!='D'){
        cout<<"No"<<endl;
        return 0;
      }
    }
  }
  cout<<"Yes"<<endl;
}

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

int main(){
  string s;
  cin>>s;
  int W=s.find("W")+1,S=s.find("S")+1,N=s.find("N")+1,E=s.find("E")+1;
  cout<<((W*E||W+E==0)&&(N*S||N+S==0)?"Yes":"No")<<endl;
}
  


Measured memory_bytes: 256
/**
       ������������    ������������
		Author : Avi J Patel
		University : DA-IICT
       ������������    ������������
**/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair 
#define N 100000
#define ff first
#define ss second
#define si size()
#define mod 1000000007
#define large 10000000000000001
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

int main()
{
	FAST;
	int n;
	cin>>n;
	vector<int> a;
	for(int i=0;i<n;i++)
	{
		int a1;
		cin>>a1;
		a.pb(a1);
	}
	//sort(a.begin(),a.end());
	for(int i=1;i<n;i++)
	{
		a[i]=a[i]+a[i-1];
	}
	int sum=a[n-1];
	int min=INT_MAX;
	for(int i=0;i<n;i++)
	{
		if(abs((sum-a[i])-a[i])<min)
		{
			min=abs((sum-a[i])-a[i]);
		}
	}
	cout<<min;
    return 0;
}








Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;

int a[100003];

int main()
{
    int N,x;
    scanf("%d",&N);
    while (N--)
    {
        int t;
        scanf("%d",&t);
        a[t]++;
        a[t + 1]++;
        a[t + 2]++;
    }
      x=*max_element(a + 2, a + 100000) ;
     printf("%d",x);
    return 0;
}

Measured memory_bytes: 4104
a, b, k = map(int, input().split())

p = k
if a < k:
    k = k - a
    a = 0
else:
    k = k - a
    a = a - p

if k < 0:
    k = 0
b = b - k
if b < 0:
    b = 0

print("{}".format(a) + " {}".format(b))


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

// #include<cstdio>

int main(){
  int n, x, min=1000000, Max=-1000000;
  long long S=0;

  cin >> n;

  for (int i=0; i<n; i++){
    cin >> x;
    if (x < min) min=x;
    if (x > Max) Max=x;
    S += x;
  }

  cout << min << ' ' << Max << ' ' << S << "\n";
  

  return 0;
}

Measured memory_bytes: 3100
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long LL;
const int MAXN=1e5+5;
int a[MAXN];
int G[105][105];

int main()
{
    int h,w;
    while(scanf("%d%d",&h,&w)!=EOF)
    {
        int n;
        cin>>n;
        for(int i=1;i<=n;++i) 
            scanf("%d",&a[i]);
        int cnt=1;
        for(int i=1;i<=h;++i)
        {
            if(i&1)
            {
                for(int j=1;j<=w;++j)
                {
                   if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                   else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }else
            {
                for(int j=w;j>=1;--j)
                {
                    if(a[cnt]>0) {G[i][j]=cnt;--a[cnt];}
                    else if(a[cnt]==0) {++cnt;G[i][j]=cnt;--a[cnt];}
                }
            }
        }
        for(int i=1;i<=h;++i)
        {
            for(int j=1;j<=w;++j)
            {
                if(j!=w) printf("%d ",G[i][j]);
                else printf("%d\n",G[i][j]);
            }
        }
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
// end of Template

ll f[4],n;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    f[0] = 2;
    f[1] = 1;
    for(int i=2;i<=n;i++){
        f[i%3] = f[(i-1)%3] + f[(i-2)%3];
    }
    cout<<f[n%3]<<newl;

}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader S = new BufferedReader(new InputStreamReader(System.in));
        String aaa = S.readLine();
        int Num = Integer.parseInt(aaa);
        calcTime calc = new calcTime(Num);
    }
}

class calcTime{
    public calcTime(int inputS){        //コンストラクタ
        int a,b,h,m,s;
        a = inputS % 3600;
        h = inputS / 3600;
        b = a % 60;
        m = a / 60;
        s = b % 60;
        System.out.println(h + ":" + m + ":" + s);
    }
}


Measured memory_bytes: 24440
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var S = Console.ReadLine();
            var answer = "";
            for (var i = 0; i < S.Length; i += 2)
            {
                answer += S[i];
            }
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 47876