akhauriyash/Code-Regression huggingface dataset:
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 10;
int n, m;
char c[maxn][maxn];

int read() {
  if (scanf("%d%d", &n, &m) < 2) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%s", c[i]);
  }
  return true;
}

void solve() {
  if (c[0][0] != '#') {
    printf("Impossible\n");
    return;
  }
  int x = 0, y = 0;
  while (x < n - 1 || y < m - 1) {
    bool found = false;
    for (int i = 0; i < 2; i++) {
      int xx = x + i, yy = y + (i ^ 1);
      if (xx < n && yy < m && c[xx][yy] == '#') {
        x = xx;
        y = yy;
        found = true;
        break;
      }
    }
    if (!found) {
      printf("Impossible\n");
      return;
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cnt += (c[i][j] == '#');
    }
  }
  if (cnt == n + m - 1) {
    printf("Possible\n");
  } else {
    printf("Impossible\n");
  }
}

int main() {
  precalc();
#ifdef LOCAL
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<algorithm>
using namespace std;
int solve(){
    int n,k;
    cin>>n>>k;
    vector<int> tt(3);
    unordered_map<char,int> ttt;
    ttt['r'] = 0;
    ttt['s'] = 1;
    ttt['p'] = 2;
    for(int i=  0;i<3;i++){
        cin>>tt[i];
    }
    vector<vector<int>> dir={{0,0,tt[2]},{tt[0],0,0},{0,tt[1],0}};
    string str;
    cin>>str;
    vector<vector<int>> dp(3,vector<int>(n+1,0));
    for(int i = 0;i<n;i++){
        int tag = ttt[str[i]];
        // cout<<tag<<endl;
        for(int j = 0;j<3;j++){
            int temp = 0;
            int sc = dir[tag][j];
            for(int q = 0;q<3;q++){
                if(j==q && i>=k) continue;
                int tttt = 0;
                if((i+1-k)>=0) tttt = dp[q][i+1-k];
                temp = max(temp,tttt+sc);
            }
            dp[j][i+1] = temp;
        }
    }
    // cout<<1<<endl;
    int sum =0;
    for(int i = 0;i<k;i++){
        int ts = 0;
        for(int j=0;j<3;j++){
            ts = max(ts,dp[j][n-i]);
        }
        sum += ts;
    }
    return sum;
}

int main(){
    int T = 1;
    while(T--){
        int res = solve();
        cout<<res<<endl;
    }
    return 0;
}

Measured memory_bytes: 2048
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>
#include <ctype.h>
using namespace std;
int p,q,min1,min2,ans=-1000000000;
int main(){
	cin>>p;
	cin>>q;min1=q;min2=q;
	for(int a=1;a<p;a++){
	cin>>q;
	if(q<min1){min1=q;}
	if(q-min2>ans){ans=q-min2;}
	min2=min1;}
	cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 1164
import java.util.*
import java.math.*
import java.lang.Math.*


val readString: ()->String = {readLine()!!}
val readInt: ()->Int = {readLine()!!.toInt()}
val readLong: ()->Long = {readLine()!!.toLong()}
val readIntArray: ()->IntArray = {readLine()!!.split(' ').map{it.toInt()}.toIntArray()}
val readLongArray: ()->LongArray = {readLine()!!.split(' ').map{it.toLong()}.toLongArray()}
val errPrintln: (String)->Unit = {msg -> System.err.println(msg)}
val MOD = 1_000_000_007L
val INF = Int.MAX_VALUE/2
val LINF = Long.MAX_VALUE/2
data class IntPair(val first: Int, val second: Int)
data class To(val idx: Int, val cost: Long)


fun solve(K: Int, P: IntArray): Int {
    val Q = P.sorted()

    var res = 0
    for (i in 0 until K) {
        res += Q[i]
    }

    return res
}


fun main(args: Array<String>) {
    val (N, K) = readIntArray()
    val P = readIntArray()

    val ans = solve(K, P)

    println(ans)
}


Measured memory_bytes: 40836
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
const int mod = 1e9+7;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) v.begin(),v.end()
#define Pr(type) priority_queue<type>
#define gPr(type) priority_queue<type,vector<type>,greater<type>>
#define V(type) vector<type>
#define rep(i,n) for(int i=0; i<n; i++)
#define rer(i,st,en) for(int i=st; i<en; i++)
#define eb emplace_back
#define pri1(a) cout<<a<<'\n'
#define pri2(a,n) rep(i,n)cout<<a[i]<<'\n'
#define pri3(a,n) rep(i,n-1)cout<<a[i]<<' '; cout<<a[n-1]<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};


int n,m,_,x,y,q;
string s;

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

  cin>>n; int ans=0,a[n];
  rep(i,n)cin>>a[i];
  rep(i,n){
    for (int j = n-1; j >= i+1; j--){
      if(a[j-1]>a[j]){swap(a[j-1],a[j]); ans++;}
    }
  }
  pri3(a,n);
  END
}


Measured memory_bytes: 3220
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] button = new int[n];
        for (int i = 0; i < n; i++) {
            button[i] = Integer.parseInt(sc.next());
        }
        int cnt = 1;
        int next = button[0];
        for (int i = 0; i < n; i++) {
            if (next == 2) {
                System.out.println(cnt);
                return;
            }
            if (button[next - 1] == 2) {
                cnt++;
                System.out.println(cnt);
                return;
            } else {
                next = button[next - 1];
                cnt++;
            }
        }
        System.out.println(-1);
    }
}


Measured memory_bytes: 48856
import sys,os
from collections import defaultdict, deque
from math import ceil, floor, inf
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
class Combinations:
    def __init__(self,n,p):
        self.n = n
        self.p = p
        self.g1 = [1,1]
        self.g2 = [1,1]
        inverse = [0,1]
        for i in range(2, self.n + 1):
            self.g1.append( ( self.g1[-1] * i ) % self.p )
            inverse.append( ( -inverse[self.p % i] * (self.p//i) ) % self.p )
            self.g2.append( (self.g2[-1] * inverse[-1]) % self.p )
    def nCr(self,r):
        if r < 0 or self.n < r:
            return 0
        r = min(r, self.n-r)
        return self.g1[self.n] * self.g2[r] * self.g2[self.n-r] % self.p

def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD =  998244353

    N,M,K = LMIIS()
    ans = 0
    cmb = Combinations(N-1,MOD)
    #i個のブロックを連結、全体でN-i個、どこを連結させるかは(N-1)Ci通り
    for i in range(K,-1,-1):
        ans += M * pow(M-1,N-i-1,MOD) * cmb.nCr(i)
        ans %= MOD
    print(ans)

    

if __name__ == '__main__':
    main()

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

#define rep(i, n) for ( ll i = 0; i < (n); ++i )
#define reps(i, n) for ( ll i = 1; i <= (n); ++i )
#define _rep(i, n) for ( ll i = (n) - 1; i >= 0; --i )
#define _reps(i, n) for ( ll i = n; i > 0; --i )
#define all(x) (x).begin(), (x).end()
#define _all(x) (x).rbegin(), (x).rend()

using namespace std;
using ll =  long long;
using P = pair<ll, ll>;

#define ABS(x) (x) < 0 ? -(x) : (x)

int main( void )
{
	ll a, b, h, m;
	cin >> a >> b >> h >> m;

	double hd = 30 * h + 0.5 * m;
	double md = 6 * m;
	double d = ABS(hd - md);
	if ( d > 180 ) {
		d = 360 - d;
	}

	printf("%.9lf\n", sqrt( a * a + b * b - 2 * a * b * cos(d * 3.1415926535 / 180) ));

	return 0;
}


Measured memory_bytes: 4136
import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        long n = sc.nextLong()-2;
        int k = sc.nextInt();
        long ret = (n/11)*5;
        long r = n%11;
        for (int i = 1;i <= r;i++) {
            for (int j = 1;j <= 5;j++) {
                if (calc(i,j,k)) ret++;
            }
        }
        System.out.println(ret);
    }
    private static boolean calc(int x, int y, int k) {
        return ((63*x+9*y+9)%11)==k;
    }
}


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

#define ul unsigned long 
#define ull unsigned long long
#define li long long int

int main()
{
  string s,t="ACGT";
  cin >> s;

  int c=0,m=0;
  for (ul i=0;i<s.length();i++) {
    if (t.find_first_of(s[i])==string::npos) {
      if (m<c) m=c;
      c=0;
    } else c++;
  }
  if (m<c) m=c;

  cout << m<<endl;

  return 0;
}


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

template <class t>
using vc = vector<t>;
template <class t>
using vvc = vector<vector<t>>;
typedef long long ll;
typedef vc<int> vi;
typedef vvc<int> vvi;
typedef pair<int, int> pi;

#define uset unordered_set
#define umap unordered_map

#define endl "\n"

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()

#define all(a) a.bg, a.ed

template <class t, class u>
ostream &operator<<(ostream &os, const pair<t, u> &p) {
    return os << "( " << p.first << ", " << p.second << " )";
}

template <class t>
ostream &operator<<(ostream &os, const vc<t> &v) {
    os << "[ ";
    for (int i = 0; i < v.size(); i++) {
        os << v[i];
        if (i != v.size() - 1) {
            os << ", ";
        }
    }
    return os << " ]";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    // cout << fixed << setprecision(18);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution

    string str;
    cin >> str;

    umap<char, char> opposite;
    opposite['N'] = 'S';
    opposite['S'] = 'N';
    opposite['E'] = 'W';
    opposite['W'] = 'E';
    uset<char> se(str.bg, str.ed);
    for (auto &d : se) {
        if (se.find(opposite[d]) == se.end()) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p){int res = 1; x = x % p;while (y > 0){    if (y & 1)        res = (res * x) % p;y = y >> 1;    x = (x * x) % p; } return res % p;}
int lcm(int a, int b) { return a / __gcd(a, b) * b; }
 
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tc;
    tc = 1;
    //cin >> tc;
    while (tc--)
    {
        int n, m;
        cin>>n>>m;
        int l = 1, r = n;
        if(n%2){
            for (int i = 0; i < m;i++){
                cout << l << " " << r << endl;
                l++;
                r--;
            }
        }
        else{
            int a[n];
            int l= n / 2, r = n / 2 + 1;
            int g = 1, h = n - 1;
            int k = 0;
            while(m){
                if(k%2==0){
                    cout << l << " " << r << endl;
                    l--;
                    r++;
                }
                else{
                    cout << g << " " << h << endl;
                    g++;
                    h--;
                }
                k++;
                m--;
            }
        }
    }

    return 0;
}

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

typedef long long ll;
typedef pair<int, int> pi;
constexpr int inf = 0x3f3f3f3f;
constexpr double EPS = 1e-30;
constexpr double PI = atan(1) * 4;

template <class T> inline void chmax(T& x, T y) {if (x < y) x = y;}
template <class T> inline void chmin(T& x, T y) {if (x > y) x = y;}
inline int LSB(int i) {return (i & -i);}

string s, res;
map <char, int> mp, mp2;

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

    cin >> s;
    for (char i : s) mp[i]++;
    res = s;
    if (mp.size() == 26) {
        for (int i = s.length() - 1; i >= 0; i--){
            for (char c = s[i]; c <= 'z'; c++){
                if (mp2[c]){
                    s[i] = c;
                    for (int k = 0; k <= i; k++) cout << s[k];
                    return 0;
                }
            }
            mp2[s[i]]++;
        }
        cout << -1 << endl;
        return 0;
    }

    for (char c = 'a'; c <= 'z'; c++){
        if (!mp[c]) {
            s += c;
            break;
        }
    }

    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int arr1[10];
int arr2[10];
int visited[10]={0};
int x1,x2;
int cnt=0;
void find(int size,vector<int>mn)
{
	if(size==0){
		cnt++;
		int flag=0;
		for(int i=0; i<n; i++){
			if(arr1[i]!=mn[i]){
				flag=1;
				break;
			}
		}
		if(flag==0)
		 x1=cnt;
		flag=0;
		for(int i=0; i<n; i++){
			if(arr2[i]!=mn[i]){
				flag=1;
				break;
			}
		}
		if(flag==0)
		 x2=cnt;
		return ;
	}
	for(int i=1; i<=n; i++){
		if(!visited[i]){
			visited[i]=1;
			mn.push_back(i);
			find(size-1,mn);
			visited[i]=0;
			mn.pop_back();
		}
	}
}
int main()
{
	cin>>n;
	for(int i=0; i<n; i++)
	 cin>>arr1[i];
	for(int i=0; i<n; i++)
	 cin>>arr2[i];
	vector<int>mn;
	find(n,mn);
	cout<<abs(x1-x2);
     return 0;
}

Measured memory_bytes: 3556
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
static const int N = 1000;
 
int lcs(string X, string Y) {
    int c[N + 1][N + 1];
    int m = X.size();
    int n = Y.size();
    int maxl = 0;
    X = " " + X;
    Y = " " + Y;
    for(int i = 0; i <= m; i++) c[i][0] = 0;
    for(int j = 0; j <= n; j++) c[0][j] = 0;
     
    for(int i = 1; i <= m; i++) {
        for(int j = 1; j <= n; j++) {
            if(X[i] == Y[j]) {
            c[i][j] = c[i - 1][j - 1] + 1;
        } else {
            c[i][j] = max(c[i - 1][j], c[i][j - 1]);
        }
        maxl = max(maxl, c[i][j]);
        }
    }
     
    return maxl;
}  
 
int main() {
    string x, y;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> x >> y;
        cout << lcs(x, y) << endl;  
    }
     
    return 0;
}

Measured memory_bytes: 7088
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;

int main(int argc, char** argv) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if (argc == 2 && atoi(argv[1]) == 123456789)
        freopen("d:\\code\\cpp\\stdin", "r", stdin);

    int r;
    cin >> r;

    if (r < 1200)
        cout << "ABC";
    else if (r<2800)
        cout << "ARC";
    else
        cout << "AGC";
    return 0;
}

Measured memory_bytes: 256
import java.io.*;

class Main {
	public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			int n = Integer.parseInt( kb.readLine() );
			String[] nums = kb.readLine().split( " " );
			int len = nums.length;
			int[] A = new int[ len ];
			
			for( int i=0; i<len; i++ ) {
				A[i] = Integer.parseInt( nums[i] );
			}
			for( int k=0; k<len; k++ ) {
				System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
			}
			
			int key;
			int j;
 			for( int i=1; i<len; i++ ) {
				key = A[i];
				j = i - 1;
				while( 0 <= j && key < A[j] ) {
					A[ j+1 ] = A[j];
					j--;
				}
				A[ j+1 ] = key;
				for( int k=0; k<len; k++ ) {
					System.out.print( k<(len-1)? A[k]+" ": A[k]+"\n" );
				}
			}

 			kb.close();
		} catch( IOException e ) {
			System.err.println( e );
		}
		
	}
}

Measured memory_bytes: 23812
from collections import deque
n = int(raw_input())

d = [0] * n
f = [0] * n
M = [[0]*n for _ in xrange(n)]
color = [0] * n
tt = 0
WHITE = 0
GRAY = 1
BLACK = 2
nt = [0] * n

def next(u):
    for v in xrange(nt[u],n):
        nt[u] = v + 1
        if M[u][v] == 1:
            return v
    return -1

def dfs_visit(r):
    global tt
    S = deque([])
    S.append(r)
    color[r] = GRAY
    tt += 1
    d[r] = tt

    while len(S) > 0:
        u = S[len(S)-1]
        v = next(u)
        if v != -1:
            if color[v] == WHITE:
                color[v] = GRAY
                tt += 1
                d[v] = tt
                S.append(v)
        else:
            S.pop()
            color[u] = BLACK
            tt += 1
            f[u] = tt

    return 0

def dfs():
    for u in xrange(n):
        if color[u] == WHITE:
            dfs_visit(u)
    for u in xrange(n):
        print "{} {} {}".format(u+1, d[u], f[u])
    
    return 0

def main():
    for i in xrange(n):
        a = map(int, raw_input().split())
        u = a[0]-1
        k = a[1]
        for j in xrange(k):
            v = a[j+2] -  1
            M[u][v] = 1
    
    dfs()
    return 0

main()

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

signed main() {
	int x, a, b;
	cin >> x >> a >> b;
	int xx = x - a;
	cout << xx % b << endl;
}


Measured memory_bytes: 3536
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int a, b;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> a >> b;
	if (a+b >= 10) cout << "error" << endl;
	else cout << a+b << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];

static const double pi = 3.141592653589793;
int main(){
    int a,b;
    cin>>a>>b;
    bool f=false;
    rep(i,a+1){
        if(((a-i)*2+i*4)==b){
            f=true;
        }
    }
    if(f){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}



Measured memory_bytes: 3636
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;

int N;
vector<int>A, B, C;
 
int main() {
	cin >> N;
	cout << N * N * N << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  char s[13];
  scanf("%s",s);
  printf("%c%c%c%c %c%c%c%c%c%c%c%c\n",s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11]);
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    //--<for debugging>
    #define whatis(x) cout << #x << " is " << x<<" ";
    #define whatisl(x) cout << #x << " is " << x<<"\n";
    #define parr(array,end)for(ll loop=0;loop<end;loop++)cout<<array[loop]<<" ";cout<<"\n";
    #define lline cout<<"\n";
    #define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"\n";}
    #define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"___";}
        
    void err(istream_iterator<string> it) {}
    template<typename T, typename... Args>
    void err(istream_iterator<string> it, T a, Args... args) {
        cout << *it << " = " << a <<" , ";
        err(++it, args...);
    }
    //--</for debugging> 
    #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
    #define testcase ll tt; cin >> tt; while(tt--)
    #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
    #define pb push_back 
    #define vars ll h,i,j,k,d,l,p,q,r,x,y,a,b,c,v,var,n,m,z,s,ans,ind1,ind2,flag,limit1,limit2,limit3,mod;
    #define vll vector<ll>
    #define pll pair<ll,ll>
    #define sll set<ll>
    #define pint pair<int,int>
    const ll INF=1e9+7;
    const ll MOD=1e9+7;
    int main()
    {
        boost vars
        string str;
        cin>>str;
        for(i=0;i<str.length();i++)
        {
            if(str[i]==',')cout<<" ";
            else cout<<str[i];
        }
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define ip pair<ll,ll>
#define vii vector<ll>
#define vpp vector<ip>
#define vdd vector<ld>
#define vb vector<bool>
#define pi  pair<ll,ip>
#define sc(x) scanf("%lli",&x)
#define c(x) cin >> x
#define fo(i,k,n) for( int i=k;i<n;i++)
#define hu 200010
#define pq priotity_queue<ll>
#define pqs priority_queue<ll,vii,greater<ll>>
#define ppq priority_queue<ip,vpp,greater<ip>>
#define INF INT_MAX
#define ff first
#define ss second
using namespace std;
const ll M = 1000000000+7;
//Grid Movement
ll dx[] = {-1, 0, 1, 0};
ll dy[] = {0, -1, 0, 1};

ld Pi= acos(-1);

ll lcm(ll a,ll b)
{
    return (a*b)/(__gcd(a,b));
}

ll mex(ll x, ll y) 
{ 
	ll res = 1;	  
	x = x % M; 
	if (x == 0) return 0; 
	while (y > 0) 
	{ 
		if (y & 1) 
		res = (res*x) % M; 
		y = y>>1; 
		x = (x*x) % M; 
	} 
	return res; 
} 

bool comp(ll comp1,ll comp2)
{
    return comp1>comp2;
}

void yes()
{
    printf("Yes\n");
}

void no()
{
    printf("No\n");
}

ll inv(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
 
    if (m == 1)
      return 0;
 
    while (a > 1)
    {
        int q = a / m;
        int t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
 
    if (x < 0)
       x += m0;
 
    return x;
}

void sieve(ll n)
{
    vii primes(n+1);
    vb is_prime(n+1);
	is_prime.resize(n+1);
	primes.resize(n+1);
 
	is_prime[0] = is_prime[1] = false;
	for(int i = 2; i<=n; i++)
	{
	    if(is_prime[i])
	    {
	    	primes.pb(i);
	        for (int j = i*i; j<=n; j+=i)
	            is_prime[j] = false;
	    }
	}
}

void solve()
{
    ld d,t,s;
    cin >> d >> t >> s;
    if(d>s*t)no();
    else yes();
}

int main()
{
//	ios_base::sync_with_stdio(0); cin.tie(0);
    ll t=1;
 //   sc(t);
    while(t--) solve();
}





Measured memory_bytes: 3764
#include <vector>
#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;
// 默认a < c < b
int solution(int a, int b, int c, int x, int y) {
	int sum = 0;
	if (c + c - a - b < 0) {
		if (x < y) {
			sum = 2 * x*c;
			sum += (y - x)*b;
			return sum;
		}
		else {
			sum = 2 * y*c;
			sum += (x - y)*a;
			return sum;
		}
	}
	else {
		return a*x + y*b;
	}
}

int main() {
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	if (a <= c && b <= c) {
		cout << a*x + b*y;
		return 0;
	}
	if (a < c) {
		cout << solution(a, b, c, x, y);
		return 0;
	}
	if (b < c) {
		cout << solution(b, a, c, y, x);
		return 0;
	}
	//c最小
	if (x > y)
		if (c * 2 - a < 0)
			cout << x * 2 * c;
		else
			cout << y*c * 2 + (x - y)*a;
	else
		if (c * 2 - b < 0)
			cout << y * 2 * c;
		else
			cout << x*c*2 + (y - x)*b;
	return 0;
}



Measured memory_bytes: 256
/* Eat a live frog first thing in the morning,
   and nothing worse will happen to you the rest of the day */
 
/* You can't connect the dots looking forward 
   you can only connect them looking backwards. */
 
/* Nothing is impossible; impossible itself says "I'm possible" */
 
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed;
#define dbset(x) for(int i=0 ; i<x.size(); i++) cerr << x[i] << " "; cerr << endl;
#define inf 1000000007
#define INF 1000000000000000000LL
#define PI 3.14159265358979323846
#define mod 1000000007
#define mod1 1000696969
#define flusz fflush(stdout);
#define VI vector<int>
#define VPI vector < pair<int,int> >
#define PII pair<int, int>
#define BIT bitset<N>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define REP(x, y) for(int x = 0; x < (y); ++x)
#define FOR(x, y, z) for(int x = y; x <= (z); ++x)
#define FORR(x, y, z) for(int x = y; x >= (z); --x)
using namespace std;
 
template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
 
#define N 1000007
#define int long long
 
int test;
 
int n,d,q;
 
int t[N];
 
int now[N];
 
int sum;
 
int res[N];
 
void solve()
{
	cin >> n >> d;
 
	FOR(i,1,n)
	{
		cin >> t[i];
	}
 
	now[0]=d;
 
	FOR(i,1,n)
	{
		now[i]=min(now[i-1],abs(now[i-1]-t[i]));
	}
 
	FORR(i,n,1)
	{
		if (sum<now[i-1])
		{
			res[i]=1;
		} 
 
		if (sum*2+1>=t[i])
			sum+=t[i];
	}
 
	cin >> q;
 
	FOR(i,1,q)
	{
		int x;
		cin >> x;
 
		if (res[x])
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
 
       return;
}
 
int32_t main()
{
    boost
 
    test=1;
 
    while(test--)
    {
         solve();
    }
 
  return 0;
}

Measured memory_bytes: 18304
#include <bits/stdc++.h> 
using namespace std; 
int main(){
    int N;
    cin >> N;
    int arr[N];
    for (int i = 0; i < N; i++) {
        cin >> arr[i];
    }
    sort(arr, arr+N);
    int total = 0;
    for (int i = 0; i < N-1; i++) {
        total = total + arr[i];
    }
    cout << total + arr[N-1]/2;
} 

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
//constexpr int MOD=1000000007;
constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

lint fac[510000],finv[510000],inv[510000];
void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<510000;i++){
    fac[i]=fac[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}
lint COM(lint n,lint k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
lint facdiv(lint n,lint k){
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return (fac[n]*finv[k])%MOD;
}

int main(void){
    COMinit();
    lint N,A,B,K;
    lint ans=0;
    cin >> N >> A >> B >> K;
    for(int i=0;i<=N;i++){
        if((K-A*i)%B!=0) continue;
        lint a=i,b=(K-A*i)/B;
        lint add=(COM(N,a)*COM(N,b))%MOD;
        ans=(ans+add)%MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 12160
#include <iostream>
#include <stdio.h>

using namespace std;
typedef long long int lint;

void answer()
{
	int n, i;
	int a[100];
	cin >> n;
	for (i = 0; i < n; i++) cin >> a[i];
	i--;
	cout << a[i];
	while (i > 0) {
		i--;
		cout << " " << a[i];
	}
	cout << endl;
}

int main()
{
	answer();
	return 0;
}

Measured memory_bytes: 1160
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    X = I()
    if X == 1:
        print(1)
        return
    nsum = 1
    n = 0
    while nsum < X:
        n += 1
        nsum = (1 + n) * n //2 
    # if nsum > X:
    #     n += 1
    print(n)
main()



Measured memory_bytes: 5836
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include<iomanip>

using namespace std;
#define     loop(n,i,a)     for(int i=a;i<n;i++)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     vi              vector<int>
#define     vll             vector<ll>
#define     sz(x)           (int)x.size()
#define     pb              push_back
int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const int N = 2e5 + 3;
int n, a[N], b[N], tmp[N], freq[28];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d", a + i);
	for (int i = 0; i < n; ++i)
		scanf("%d", b + i);
	int res = 0;
	for (int bit = 0; bit <= 28; ++bit) {
		int MOD = (1 << (bit + 1));
		for (int i = 0; i < n; ++i)
			tmp[i] = b[i] % MOD;
		sort(tmp, tmp + n);
//		for (int i = 0; i < n; ++i)
//			cout << tmp [i] << " ";
//		cout << endl;
//		cout << " -------------- " << endl << bit << ":" << endl;
		for (int i = 0; i < n; ++i) {
			int x = lower_bound(tmp, tmp + n, (1 << bit) - a[i] % MOD) - tmp;
			int y = upper_bound(tmp, tmp + n, MOD - 1 - a[i] % MOD) - tmp - 1;

			int v = lower_bound(tmp, tmp + n, (1 << bit) + MOD - a[i] % MOD) - tmp;
			int u = upper_bound(tmp, tmp + n, MOD + MOD - 1 - a[i] % MOD) - tmp - 1;

			freq[bit] += y - x + 1  + v - u + 1;
		}
		if (freq[bit] % 2)
			res |= (1 << bit);
	}
	printf("%d\n", res);
	return 0;
}

/*
1 2 3 4 5
1 2 3 4 5

11+? = 010
11+1 = 100

1 1
1 2
1 5
2 1
2 4
2 5
3 3
3 4
4 1
4 3
4 5
5 2
5 4

 */




Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <map>
#include <cmath>
#include <bitset>
#include <deque>
#define MAX_N 100
#define MAX_T 200
#define INF 4000000000000000000
#define fst first
#define snd second
typedef long long ll;
typedef std::pair<int,int> ii;
using namespace std;

int main(){
  int n,l,r,ans;
  ans=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>l>>r;
    ans+=r-l+1;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.BigInteger;
 
public class Main {
	public static long mod = 1000000007;
	
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	String S = s.next();
	

	if(S.charAt(S.length()-1) == 's'){
		System.out.println(S+"es");
	}else{
		System.out.println(S+"s");
	}
	
    
  }
}

Measured memory_bytes: 38500
#include<bits/stdc++.h>
using namespace std;
vector<int>dy({0,-1,0,1}),dx({1,0,-1,0});

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	string mc="MARCH"s;
	unordered_map<char,int>m;
	for(int i=0;i<n;++i){
		string s; cin>>s;
		for(auto&&j:mc){
			if(s.front()==j){
				++m[j];
				break;
			}
		}
	}
	vector<int>v; for(auto&&i:m)v.emplace_back(i.second);
	int64_t ans=0;
	for(int i=0;i<v.size();++i){
		for(int j=i+1;j<v.size();++j){
			for(int k=j+1;k<v.size();++k){
				ans+=1L*v.at(i)*v.at(j)*v.at(k);
			}
		}
	}
	cout<<ans<<"\n"s;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    rep(i,0,b){
        if((a*i)%b==c){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
  if(a < b)swap(a,b);
  while(b != 0){
    int c = a % b;
    a = b;
    b = c;
    if(b == 0) return a;
  }
}
int main(){
  int n,X;
  cin >> n >> X;
  vector<int> x(n);
  for(int i = 0;i < n;i++){
    cin >> x[i];
    x[i] = abs(X-x[i]);
  }
  int ans = gcd(x[0],x[0]);
  for(int i = 0;i < n;i++){
    ans = gcd(ans,x[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>

using namespace std;

struct Card
{
    int attack;
    int cost;
};



class Solver
{
private:
    vector<Card> cards;
    int card_num; 
    int cost_max;

public:
    Solver(){}

    Solver(vector<Card> cards_, int card_num_, int cost_max_) : cards(cards_), card_num(card_num_), cost_max(cost_max_) {}

    void exec() {
        vector<vector<int> > dp = vector<vector<int> >(card_num + 1, vector<int>(cost_max + 1, 0));
        for (int i = 0; i < card_num; ++i)
        {
            for (int j = 0; j <= cost_max; ++j)
            {
                if(i == 0) {
                    if(j - cards[i].cost >= 0) dp[i][j] = cards[i].attack;
                    continue;
                }
                if(j - cards[i].cost >= 0) {
                    dp[i][j] = max(dp[i-1][j- cards[i].cost] + cards[i].attack, dp[i-1][j]);
                } else {
                    dp[i][j] = dp[i-1][j];
                }
                // cout << dp[i][j] << " ";
            }
            // cout << endl;

        }
        cout << dp[card_num-1][cost_max] << endl;
    }
};




int main(int argc, char *argv[])
{
    // start from 1 to ignore script name; argv[0] will be a name of processing file.
    // for (int i = 1; i < argc; i++) {
    //  printf ("argv[%i]: %s\n", i, argv[i]);
    // }
    int card_num, cost_max;
    // int arg_int = 1;
    // card_num = atoi(argv[arg_int]);
    // arg_int++;
    // cost_max = atoi(argv[arg_int]);
    // arg_int++;

    vector<Card> cards;
    // for (int i = 0; i < card_num; ++i)
    // {
    //     Card tmp_card = { atoi(argv[arg_int]),  atoi(argv[arg_int + 1])};
    //     arg_int += 2;
    //     cards.push_back(tmp_card);
    // }

    cin >> card_num;
    cin >> cost_max;
    cards.resize(card_num);
    for (int i = 0; i < card_num; ++i)
    {
     cin >> cards[i].attack >> cards[i].cost;
    }


    Solver s = Solver(cards, card_num, cost_max);
    s.exec();
    return 0;
}

Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

int main() {
  ll N ; cin >> N;
  vi name;
  while (N>0){
    N--;
    ll ta = N%26;
    N /= 26;
    name.push_back(ta);
  } 
  reverse(all(name));
  string alph = "abcdefghijklmnopqrstuvwxyz";
  rep(i,name.size()) cout << alph[name[i]];
  cout << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

int main() {

    ll H, W;
    cin >> H >> W;
    ll ans = 0;
    if (H == 1 || W == 1){
        ans = 1;
    }
    else if ((H * W) % 2 == 0){
        ans = H * W / 2;
    }else ans = (H * W + 1) / 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
    const int max = 50;
    int counters[max];
    int a, b, c, d, i, maxUsable, target = 0, index;

    for (i = 0; i < max; i++) {
        counters[i] = -1;
    }

    while (cin >> target) {
        index = target-1;

        // 前回の計算結果があればそれを出力
        if (counters[index] != -1) {
            cout << counters[index] << endl;
            continue;
        }

        // 総当りで計算
        if (counters[index] == -1) counters[index] = 0;

        maxUsable = target >= 9 ? 9 : target;
        for (a = 0; a <= maxUsable; a++) {
            for (b = 0; b <= maxUsable; b++) {
                for (c = 0; c <= maxUsable; c++) {
                    for (d = 0; d <= maxUsable; d++) {
                        if (a + b + c + d == target) {
                            counters[index]++;
                        }
                    }
                }
            }
        }

        // 結果の出力
        cout << counters[index] << endl;
    }

    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	
	using namespace std;
	int main()
	{
		std::ios::sync_with_stdio(false);
		int T;
		T=1;
		// cin.ignore(); must be there when using getline(cin, s)
		while(T--)
		{
			string s,t;
			cin>>s>>t;
			int ans=INT_MAX;
			for(int i=0;i<(s.size()-t.size()+1);i++){
				int count=0;
				for(int j=0;j<t.size();j++){
					if(s[i+j]!=t[j])
						count++;
				}
				ans=min(ans,count);
			}	
			cout<<ans;
		}
		return 0;
	}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

struct POINT
{
	int x, y;
	bool operator<(const POINT &t)const{
		if (x == t.x) return y < t.y;
		return x < t.x;
	}
	bool operator==(const POINT &t)const{
		return x == t.x && y == t.y;
	}
};

struct P
{
	POINT l, r;
	bool operator<(const P &t)const{
		if (l == t.l) return r < t.r;
		return l < t.l;
	}
};

char g1[64][64], g2[64][64];

int main()
{
	int w, h;
	while (scanf("%d %d", &w, &h), w + h){
		memset(g1, '#', sizeof(g1));
		memset(g2, '#', sizeof(g2));
		
		POINT L, R;
		for (int i = 1; i <= h; i++){
			for (int j = 1; j <= w; j++){
				scanf(" %c", &g1[i][j]);
				if (g1[i][j] == 'L'){
					L = {i, j};
					g1[i][j] = '.';
				}
			}
			for (int j = w; j >= 1; j--){
				scanf(" %c", &g2[i][j]);
				if (g2[i][j] == 'R'){
					R = {i, j};
					g2[i][j] = '.';
				}
			}
		}
		
		queue<P> que;
		static bool done[51][51][51][51] = {false};
		memset(done, 0, sizeof(done));
		bool res = false;
		for (que.push({L, R}); !que.empty(); que.pop()){
			P p = que.front();
			
			//printf("%d %d %d %d\n", p.l.x, p.l.y, p.r.x, p.r.y);
			
			if (done[p.l.x][p.l.y][p.r.x][p.r.y]) continue;
			done[p.l.x][p.l.y][p.r.x][p.r.y] = true;
			
			if (g1[p.l.x][p.l.y] == '%' && g2[p.r.x][p.r.y] == '%'){
				res = true;
				break;
			}
			if (g1[p.l.x][p.l.y] == '%' || g2[p.r.x][p.r.y] == '%'){
				continue;
			}
			
			for (int dir = 0; dir < 4; dir++){
				int ltx = p.l.x + dx[dir];
				int lty = p.l.y + dy[dir];
				int rtx = p.r.x + dx[dir];
				int rty = p.r.y + dy[dir];
				
				if (g1[ltx][lty] == '#'){
					ltx = p.l.x;
					lty = p.l.y;
				}
				if (g2[rtx][rty] == '#'){
					rtx = p.r.x;
					rty = p.r.y;
				}
				
				que.push({{ltx, lty}, {rtx, rty}});
			}
		}
		printf(res ? "Yes\n" : "No\n");
	}
	
	return 0;
}

Measured memory_bytes: 11348
str = gets.chomp
n = str.length
answer = 0
a = 0

for x in 0...n
  if str[x] == "A" || str[x] == "T" || str[x] == "G" || str[x] == "C"
    a += 1
  else
    if a > answer
      answer = a
    end
    a = 0
  end
end

if a > answer
  answer = a
end

puts answer

Measured memory_bytes: 1916
#include <iostream>
#include <string>

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
   
    int n, m, k;
    cin >> n>>m>>k;

    for(int i = 0; i <= m; i++ ){
        for(int j = 0; j <= n; j++){
            if((n-j)*i + (m-i)*j == k){
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";

    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);
    for(int i=0;i<n;i++) cin >> a[i];
    int count=0;
    
    for(int i=0;i<n;i++){
        while(a[i]%2==0){
                a[i]/=2;
                count++;
        }
    }

    cout << count << endl;
    return 0;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    ll x, y;
    cin >> x >> y;
    if (x % y != 0) cout << x << endl;
    else cout << -1 << endl;
}


Measured memory_bytes: 3572
import java.text.DecimalFormat;
import java.util.Scanner;

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

		int num = Integer.parseInt(sc.nextLine());
		DecimalFormat df = new DecimalFormat("000");
		System.out.println("ABC" + df.format(num));
	}
}


Measured memory_bytes: 22228
///not today

#include<bits/stdc++.h>
using namespace std;

#define SZ(x) (int)(x).size()
#define pb push_back
#define ll long long
#define xmax(x, y) (x) = max((x), (y))
#define xmin(x, y) (x) = min((x), (y))
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<long long, long long>
#define int long long
#define pipii pair<int, pair<int, int> >

int32_t main(){
    int a, b, c, cn = -1;
    cin >>a >>b >>c;
    if((a% 2) or (b% 2) or (c% 2))
        return cout <<0 <<endl, false;
    for(int i = 30; i >= 0; i --){
        int x = (1 <<i);
        if(((b & x) != (a & x)) or ((c & x) != (a & x))){
            cn = i;
        }
    }
    cout <<cn <<endl;
    return false;
}


Measured memory_bytes: 256
//#pragma comment(linker, "/stack:200000000")
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set =
	tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define un(x) x.erase(unique(ALL(x)),x.end())
#define REP(i,x,v)for(int i=x;i<=v;i++)
#define REPD(i,x,v)for(int i=x;i>=v;i--)
#define FOR(i,v)for(int i=0;i<v;i++)
 
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int MOD=1e9+7;//998244353;

	
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);
	cout << fixed << setprecision(11);
	cerr << fixed << setprecision(6);
	set<int> s;
	int n;cin>>n;
	FOR(i,n) {int x;cin>>x;s.insert(x);}
	if (SZ(s)==n) cout<<"YES\n";
	else cout<<"NO\n";


    return 0;
}










Measured memory_bytes: 9600
import sys
sys.setrecursionlimit(10**6)

#def input():
#  return sys.stdin.readline()[:-1]

n,q=map(int,input().split())
cnt=[0]*(n)
g=[[] for _ in range(n)]
for _ in range(n-1): #木グラフの隣接リストを作成
  a,b=map(int,input().split())
  g[a-1].append(b-1)
  g[b-1].append(a-1)
for _ in range(q):
    a , b = map(int,input().split())
    a = a - 1
    cnt[a] += b

def dfs(now,prev=-1):
  for next in g[now]:
    if next==prev:
      continue
      
    cnt[next]+=cnt[now]
    dfs(next,now)
dfs(0)
print(*cnt)


Measured memory_bytes: 282876